UnsdDataParser { public static List<IdNamePair> getSortedListOfYearsThatBelongToSeveralGeoAreas( Map<Integer, Set<Integer>> countOfAreaCodesForYear) { return countOfAreaCodesForYear.entrySet().stream() .filter(e -> e.getValue().size() > 1) .map(e -> e.getKey()) .sorted(Comparator.reverseOrder()) .map(year -> new IdNamePair(String.valueOf(year), null)) .collect(Collectors.toList()); } UnsdDataParser(UnsdConfig config); Map<String, IndicatorValue> get(StatisticalIndicatorDataModel selectors, String indicator, String[] areaCodes); StatisticalIndicatorDataDimension getTimeperiodDimensionFromIndicatorData(String timePeriodDimensionId,
            String indicator, String[] areaCodes); static void parseTimePeriod(Map<Integer, Set<Integer>> geoAreaCodesForYears, JSONObject response); static List<IdNamePair> getSortedListOfYearsThatBelongToSeveralGeoAreas(
            Map<Integer,  Set<Integer>> countOfAreaCodesForYear);  }
@Test public void testIndicatorTimePeriodFilteringAndSorting() { List <IdNamePair> result = UnsdDataParser.getSortedListOfYearsThatBelongToSeveralGeoAreas(TIMEPERIOD_FILTER_AND_SORT_TEST_INPUT); assertNotNull(result); assertEquals(EXPECTED_TIMEPERIOD_FILTERED_AND_SORTED_VALUES, result); }