### Question:
PageViewUtils { public static SortedSet<DateTime> timestampsInInterval(DateTime start, DateTime end) { if (start.isAfter(end)) { throw new IllegalArgumentException(); } DateTime current = new DateTime( start.year().get(), start.monthOfYear().get(), start.dayOfMonth().get(), start.hourOfDay().get(), 0); if (current.isBefore(start)) { current = current.plusHours(1); } SortedSet<DateTime> result = new TreeSet<DateTime>(); while (!current.isAfter(end)) { result.add(current); current = current.plusHours(1); } return result; }  static SortedSet<DateTime> timestampsInInterval(DateTime start, DateTime end);  }### Answer:
@Test public void testTstampsInRange() { long now = System.currentTimeMillis(); Random random = new Random(); for (int i = 0; i < 1000; i++) { long tstamp = (long) (random.nextDouble() * now); DateTime beg = new DateTime(tstamp); DateTime end = beg.plusHours(1); SortedSet<DateTime> tstamps = PageViewUtils.timestampsInInterval(beg, end); assertEquals(tstamps.size(), 1); DateTime dt = tstamps.first(); assertTrue(beg.isBefore(dt)); assertTrue(end.isAfter(dt)); } }