### Question:
PatchingServiceImpl implements PatchingService, Constants { @Override public List<Map<String, Object>> getQuartersWithPatchingData( String assetGroup) throws ServiceException { Map<String, Long> patchingCountByQuarter; try { patchingCountByQuarter = repository .getQuartersWithPatchingData(assetGroup); } catch (DataException e) { throw new ServiceException(e); } Map<Long, List<Long>> yearQuarterMap = new HashMap<>(); patchingCountByQuarter.forEach((key, value) -> { LocalDateTime dateTime = LocalDateTime.parse(key, DateTimeFormatter.ISO_DATE_TIME); LocalDate date = dateTime.toLocalDate(); Long year = (long) date.getYear(); List<Long> existingQuartersForCurrentYear = yearQuarterMap .get(year); if (null == existingQuartersForCurrentYear) { existingQuartersForCurrentYear = new ArrayList<>(); yearQuarterMap.put(year, existingQuartersForCurrentYear); } Long quarter = (long) (((date.getMonthValue() - 1) / THREE) + 1); existingQuartersForCurrentYear.add(quarter); }); List<Map<String, Object>> listOfYears = new ArrayList<>(); yearQuarterMap.forEach((key, value) -> { Map<String, Object> mapForCurrentYear = new HashMap<>(); mapForCurrentYear.put("year", key); mapForCurrentYear.put("quarters", value); listOfYears.add(mapForCurrentYear); }); if (listOfYears.isEmpty()) { throw new ServiceException(NO_DATA_FOUND); } return listOfYears; }  @Override List<Map<String, Object>> getNonCompliantNumberForAG(
            String assetGroup); @Override List<Map<String, Object>> getNonCompliantExecsForAG(String assetGroup); @Override List<Map<String, Object>> getPatchingDetails(String assetGroup,
            Map<String, String> filter); @Override Map<String, Object> getPatchingProgress(String assetGroup, int year,
            int quarter); @Override List<Map<String, Object>> getQuartersWithPatchingData(
            String assetGroup); @Override LocalDate getFirstDayOfQuarter(int quarterNumber, int year); @Override LocalDate getLastDayOfQuarter(int quarterNumber, int year); @Override int getOngoingQuarter(); @Override int getOngoingYear(); @Override Object filterMatchingCollectionElements(
            List<Map<String, Object>> masterDetailList, String searchText,
            boolean b); @Override Medal getStarRatingForAgPatching(String ag, int quarter, int year);  }### Answer:
@Test public void getQuartersWithPatchingDataTest() throws Exception { Map<String, Long> nonComplaintMap = new HashMap<>(); nonComplaintMap.put("2018-04-01T00:00:00.000Z", 100l); when(repository.getQuartersWithPatchingData(anyString())) .thenReturn(nonComplaintMap); assertThat(patchingServiceImpl.getQuartersWithPatchingData("anyString"), is(notNullValue())); }