コード例 #1
0
 // Compares a few values with data calculated by hand.
 public void testIndividualValues() throws Exception {
   List<Pair<Long, LocalDate>> testData =
       ImmutableList.of(
           entry(13879, 2008, 1, 1),
           entry(13880, 2008, 1, 2),
           entry(13881, 2008, 1, 3),
           // Check dates around leap second.
           entry(14244, 2008, 12, 31),
           entry(14245, 2009, 1, 1),
           entry(15706, 2013, 1, 1));
   for (Pair<Long, LocalDate> entry : testData) {
     long a = entry.getFirst();
     LocalDate b = entry.getSecond();
     assertEquals(a, DaysSinceEpoch.fromLocalDate(b));
     assertEquals(b, DaysSinceEpoch.toLocalDate(a));
   }
 }
コード例 #2
0
 private Pair<Long, LocalDate> entry(long days, int y, int m, int d) {
   return Pair.of(days, new LocalDate(y, m, d));
 }