### Question:
ESProxyFilter implements Filter { protected ElasticsearchClientService getElasticsearchClientService() { if (useStatsClient) return statsClientService; else return searchClientService; }  @Override void init(FilterConfig filterConfig); @Override void destroy(); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain);  }### Answer:
@Test public void getElasticsearchClientService() { ESProxyFilter tested = getTested(); tested.searchClientService = Mockito.mock(SearchClientService.class); tested.statsClientService = Mockito.mock(StatsClientService.class); Assert.assertEquals(tested.searchClientService, tested.getElasticsearchClientService()); tested.useStatsClient = true; Assert.assertEquals(tested.statsClientService, tested.getElasticsearchClientService()); tested.useStatsClient = false; Assert.assertEquals(tested.searchClientService, tested.getElasticsearchClientService()); }