### Question:
PatchingRepositoryImpl implements PatchingRepository, Constants { @Override public List<Map<String, Object>> getPatchingPercentForDateRange(String assetGroup, LocalDate fromDate, LocalDate toDate){ List<String> fieldList = new ArrayList<>(); Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(CommonUtils.convertAttributetoKeyword("ag"),assetGroup); Map<String, Object> rangeMap = new HashMap<>(); rangeMap.put("gte", fromDate.format(DateTimeFormatter.ISO_DATE)); rangeMap.put("lte", toDate.format(DateTimeFormatter.ISO_DATE)); Map<String, Object> dateRangeMap = new HashMap<>(); dateRangeMap.put("date", rangeMap); mustFilter.put(RANGE, dateRangeMap); fieldList.add("patching_percentage"); fieldList.add("date"); fieldList.add("ag"); try { return elasticSearchRepository.getSortedDataFromES(AG_STATS, "patching", mustFilter, null, null, fieldList, null, null); } catch (Exception e) { return null; } }  @Override List<Map<String, Object>> getPatchingProgress(String assetGroup,
            LocalDate startDate, LocalDate endDate); @Override List<Map<String, Object>> getIssueInfo(String assetGroup); List<Map<String, Object>> getClosedIssueInfo(String assetGroup,
            int size); @Override List<Map<String, Object>> getInstanceInfo(String assetGroup,
            Map<String, String> filters); @Override List<Map<String, Object>> getExecAndDirectorInfo(); @Override long getInstanceInfoCount(String assetGroup,
            Map<String, String> filters, String searchText); @Override String getAmilAvailDate(int year, int quarter); @Override int getPatchingWindow(); @Override Map<String, Long> getQuartersWithPatchingData(String assetGroup); Map<String, Object> addParentConditionPatching(String targetType); @Override List<Map<String, Object>> getOnpremIssueInfo(String assetGroup); @Override List<Map<String, Object>> getOnpremResourceInfo(String assetGroup,
            Map<String, String> filters); @Override Map<String, Object> getDirectorsAndExcutiveSponsers(String appTag,
            String appType); @Override Map<String, Long> getNonCompliantNumberForAgAndResourceType(
            String assetGroup, String resourceType); @Override List<Map<String, Object>> getPatchingPercentForDateRange(String assetGroup, LocalDate fromDate,
			LocalDate toDate);  }### Answer:
@Test public void getPatchingPercentForDateRangeTest() throws Exception{ List<Map<String, Object>> patchingInfoList = new ArrayList<>(); Map<String, Object> patchingInfoMap = new HashMap<>(); patchingInfoMap.put("patching_percentage", "20"); patchingInfoList.add(patchingInfoMap); when( elasticSearchRepository.getSortedDataFromES(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenReturn(patchingInfoList); List<Map<String, Object>> result = patchingRepositoryImpl.getPatchingPercentForDateRange( "aws-all", LocalDate.now(), LocalDate.now()); assertTrue(result.size()==1); }