FeedServiceImpl implements IFeedService { @Override public Response search(SearchDTO searchDTO) { ProjectLogger.log("FeedServiceImpl:search method called : ", LoggerEnum.INFO.name()); Future<Map<String, Object>> resultF = getESInstance().search(searchDTO, ProjectUtil.EsType.userfeed.getTypeName()); Map<String, Object> result = (Map<String, Object>) ElasticSearchHelper.getResponseFromFuture(resultF); Response response = new Response(); response.put(JsonKey.RESPONSE, result); return response; }  static CassandraOperation getCassandraInstance(); static ElasticSearchService getESInstance(); @Override Response insert(Feed feed); @Override Response update(Feed feed); @Override List<Feed> getRecordsByProperties(Map<String, Object> properties); @Override Response search(SearchDTO searchDTO); @Override void delete(String id);  }
@Test public void testSearch() { Response response = feedService.search(search); when(ElasticSearchHelper.getResponseFromFuture(Mockito.any())).thenReturn(esResponse); PowerMockito.when(esUtil.search(search, ProjectUtil.EsType.userfeed.getTypeName())) .thenReturn(promise.future()); Assert.assertTrue(esResponse != null); }