Search in sources :

Example 36 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method test_adjustDate.

//-----------------------------------------------------------------------
// adjustInto()
//-----------------------------------------------------------------------
@Test
public void test_adjustDate() {
    MonthDay test = MonthDay.of(6, 30);
    LocalDate date = LocalDate.of(2007, 1, 1);
    assertEquals(test.adjustInto(date), LocalDate.of(2007, 6, 30));
}
Also used : MonthDay(java.time.MonthDay) LocalDate(java.time.LocalDate) Test(org.testng.annotations.Test)

Example 37 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method test_withMonth_int_noChangeEqual.

@Test
public void test_withMonth_int_noChangeEqual() {
    MonthDay test = MonthDay.of(6, 30);
    assertEquals(test.withMonth(6), test);
}
Also used : MonthDay(java.time.MonthDay) Test(org.testng.annotations.Test)

Example 38 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method doTest_comparisons_MonthDay.

void doTest_comparisons_MonthDay(MonthDay... localDates) {
    for (int i = 0; i < localDates.length; i++) {
        MonthDay a = localDates[i];
        for (int j = 0; j < localDates.length; j++) {
            MonthDay b = localDates[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);
            }
        }
    }
}
Also used : MonthDay(java.time.MonthDay)

Example 39 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method factory_parse_success.

@Test(dataProvider = "goodParseData")
public void factory_parse_success(String text, MonthDay expected) {
    MonthDay monthDay = MonthDay.parse(text);
    assertEquals(monthDay, expected);
}
Also used : MonthDay(java.time.MonthDay) Test(org.testng.annotations.Test)

Example 40 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method test_equals.

//-----------------------------------------------------------------------
// equals()
//-----------------------------------------------------------------------
@Test
public void test_equals() {
    MonthDay a = MonthDay.of(1, 1);
    MonthDay b = MonthDay.of(1, 1);
    MonthDay c = MonthDay.of(2, 1);
    MonthDay d = MonthDay.of(1, 2);
    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), true);
    assertEquals(a.equals(c), false);
    assertEquals(a.equals(d), false);
    assertEquals(b.equals(a), true);
    assertEquals(b.equals(b), true);
    assertEquals(b.equals(c), false);
    assertEquals(b.equals(d), false);
    assertEquals(c.equals(a), false);
    assertEquals(c.equals(b), false);
    assertEquals(c.equals(c), true);
    assertEquals(c.equals(d), false);
    assertEquals(d.equals(a), false);
    assertEquals(d.equals(b), false);
    assertEquals(d.equals(c), false);
    assertEquals(d.equals(d), true);
}
Also used : MonthDay(java.time.MonthDay) Test(org.testng.annotations.Test)

Aggregations

MonthDay (java.time.MonthDay)59 Test (org.junit.Test)27 Test (org.testng.annotations.Test)25 LocalDate (java.time.LocalDate)9 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)4 DateTimeFormatter (java.time.format.DateTimeFormatter)3 Clock (java.time.Clock)2 Instant (java.time.Instant)2 ZoneId (java.time.ZoneId)2 Cache (com.google.common.cache.Cache)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 Subscribe (com.google.common.eventbus.Subscribe)1 IOException (java.io.IOException)1 YearMonth (java.time.YearMonth)1 java.util (java.util)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Collectors (java.util.stream.Collectors)1 JDOUserException (javax.jdo.JDOUserException)1 PersistenceManager (javax.jdo.PersistenceManager)1 Transaction (javax.jdo.Transaction)1