Esempio n. 1
0
 @Test
 public void testEqualsNotEqualYear() throws Exception {
   MinguoDate a = MinguoDate.of(testYear, testMonthOfYear, testDayOfMonth);
   MinguoDate b = MinguoDate.of(testYear + 1, testMonthOfYear, testDayOfMonth);
   assertEquals(a.equals(b), false);
   assertEquals(b.equals(a), false);
   assertEquals(a.equals(a), true);
   assertEquals(b.equals(b), true);
 }
Esempio n. 2
0
 void doTestComparisons(MinguoDate... dates) {
   for (int i = 0; i < dates.length; i++) {
     MinguoDate a = dates[i];
     for (int j = 0; j < dates.length; j++) {
       MinguoDate b = dates[j];
       if (i < j) {
         assertTrue(a.compareTo(b) < 0, a + " <=> " + b);
         assertEquals(a.isBefore(b), true, a + " <=> " + b);
         assertEquals(a.isAfter(b), false, a + " <=> " + b);
         assertEquals(a.equals(b), false, a + " <=> " + b);
       } else if (i > j) {
         assertTrue(a.compareTo(b) > 0, a + " <=> " + b);
         assertEquals(a.isBefore(b), false, a + " <=> " + b);
         assertEquals(a.isAfter(b), true, a + " <=> " + b);
         assertEquals(a.equals(b), false, a + " <=> " + b);
       } else {
         assertEquals(a.compareTo(b), 0, a + " <=> " + b);
         assertEquals(a.isBefore(b), false, a + " <=> " + b);
         assertEquals(a.isAfter(b), false, a + " <=> " + b);
         assertEquals(a.equals(b), true, a + " <=> " + b);
       }
     }
   }
 }
Esempio n. 3
0
 @Test
 public void testEqualsStringFalse() throws Exception {
   assertEquals(testDate.equals("2009-07-15"), false);
 }
Esempio n. 4
0
 @Test
 public void testEqualsItselfTrue() throws Exception {
   assertEquals(testDate.equals(testDate), true);
 }