@Test public void shouldCatchInvalidDateRange() { List<String> invalidRanges = Arrays.asList("123-1234", "1234-123", "12345-1234", "1234-12345", "123A-1234", "1234-123A", "12341234", "1234--1234", "2001-2001", "2001-2000"); for (String range : invalidRanges) { try { initRepo(); calc.findDateRange(range); Assert.fail("Did not catch an invalid range: " + range); } catch (QueryParseException e) { } } }
public SessionDateInfo findDateRange(String schoolYearRange) { Pair<String, String> years = parseDateRange(schoolYearRange); Set<String> edOrgIds = edOrgHelper.getDirectEdorgs(); Iterable<Entity> sessions = getSessions(years, edOrgIds); return findMinMaxDates(sessions); }
SessionRangeCalculator { public SessionDateInfo findDateRange(String schoolYearRange) { Pair<String, String> years = parseDateRange(schoolYearRange); Set<String> edOrgIds = edOrgHelper.getDirectEdorgs(); Iterable<Entity> sessions = getSessions(years, edOrgIds); return findMinMaxDates(sessions); } }
SessionRangeCalculator { public SessionDateInfo findDateRange(String schoolYearRange) { Pair<String, String> years = parseDateRange(schoolYearRange); Set<String> edOrgIds = edOrgHelper.getDirectEdorgs(); Iterable<Entity> sessions = getSessions(years, edOrgIds); return findMinMaxDates(sessions); }  }
SessionRangeCalculator { public SessionDateInfo findDateRange(String schoolYearRange) { Pair<String, String> years = parseDateRange(schoolYearRange); Set<String> edOrgIds = edOrgHelper.getDirectEdorgs(); Iterable<Entity> sessions = getSessions(years, edOrgIds); return findMinMaxDates(sessions); }  SessionDateInfo findDateRange(String schoolYearRange); }
SessionRangeCalculator { public SessionDateInfo findDateRange(String schoolYearRange) { Pair<String, String> years = parseDateRange(schoolYearRange); Set<String> edOrgIds = edOrgHelper.getDirectEdorgs(); Iterable<Entity> sessions = getSessions(years, edOrgIds); return findMinMaxDates(sessions); }  SessionDateInfo findDateRange(String schoolYearRange);  }