### Question:
CostRepository { public List<String> fetchApplicationMasterList() { List<String> cloudApps = new ArrayList<>(); Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put("_appType.keyword","Cloud"); mustFilter.put("latest",true); List<String> sourceFields = new ArrayList<>(); sourceFields.add("appTag"); try { List<Map<String, Object>> result = elasticSearchRepository.getDataFromES("aws_apps", "apps", mustFilter, null, null, sourceFields, null); cloudApps = result.stream().filter(app-> app.get("appTag")!=null).map(app-> app.get("appTag").toString()).collect(Collectors.toList()); } catch (Exception e) { LOGGER.error("Error fetching applications",e); } return cloudApps; }  List<Map<String,Object>> getCostAggs(List<String> appNameList); List<Map<String,Object>> getCostAggsWithTT(List<String> appNameList, List<String> tTypeList); Map<String,Integer> findLatestCostFinalisedMonth(); List<String> fetchApplicationMasterList();  }### Answer:
@Test public void fetchApplicationMasterListTest() throws Exception { List<Map<String,Object>> appList = new ArrayList<>(); Map<String,Object> app = new HashMap<>(); app.put("appTag", "app"); appList.add(app); when(elasticSearchRepository.getDataFromES(anyString(),anyString(),anyObject(),anyObject(),anyObject(),anyObject(),anyObject())).thenReturn(appList); assertTrue(costRepository.fetchApplicationMasterList().size() == 1); }