### Question:
TimeParser { public static void parse(String value, final long defaultPeriod, final List<Date> dates) throws ParseException { if (value == null) { return; } value = value.trim(); if (value.length() == 0) { return; } final StringTokenizer periods = new StringTokenizer(value, ","); while (periods.hasMoreTokens()) { final StringTokenizer elements = new StringTokenizer(periods.nextToken().trim(), "/"); if (!elements.hasMoreTokens()) { continue; } final Date start = parseDate(elements.nextToken()); if (!elements.hasMoreTokens()) { dates.add(start); continue; } final Date end = parseDate(elements.nextToken()); final long period; if (elements.hasMoreTokens()) { period = parsePeriod(elements.nextToken()); } else { period = defaultPeriod; } long time = start.getTime(); final long endTime = end.getTime(); if (period <= 0) { dates.add(start); dates.add(end); } else { while (time <= endTime) { dates.add(new Date(time)); time += period; } } } } private  TimeParser(final String pattern); static void parse(String value, final long defaultPeriod, final List<Date> dates); static Date toDate(final String strTime); @Override boolean equals(final Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testInterval() throws ParseException { final DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH'Z'"); format.setTimeZone(TimeZone.getTimeZone("UTC")); final List<Date> dates = new ArrayList<Date>(); TimeParser.parse(PERIOD, TimeParser.MILLIS_IN_DAY, dates); assertFalse(dates.isEmpty()); assertEquals(format.parse("2007-01-01T12Z"), dates.get(0)); assertEquals(format.parse("2007-01-03T00Z"), dates.get(1)); assertEquals(format.parse("2007-01-04T12Z"), dates.get(2)); assertEquals(format.parse("2007-01-06T00Z"), dates.get(3)); assertEquals(format.parse("2007-01-07T12Z"), dates.get(4)); assertEquals(format.parse("2007-01-09T00Z"), dates.get(5)); assertEquals(format.parse("2007-01-10T12Z"), dates.get(6)); assertEquals(format.parse("2007-01-12T00Z"), dates.get(7)); }