Search in sources :

Example 51 with LocalDate

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

the class TCKLocalDate method test_atTime_int_int_int_int_nanoTooBig.

@Test(expectedExceptions = DateTimeException.class)
public void test_atTime_int_int_int_int_nanoTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 30, 40, 1000000000);
}
Also used : LocalDate(java.time.LocalDate) Test(org.testng.annotations.Test)

Example 52 with LocalDate

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

the class TCKLocalDate method test_plus_Period_positiveMonths.

//-----------------------------------------------------------------------
// plus(Period)
//-----------------------------------------------------------------------
@Test
public void test_plus_Period_positiveMonths() {
    MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.MONTHS);
    LocalDate t = TEST_2007_07_15.plus(period);
    assertEquals(t, LocalDate.of(2008, 2, 15));
}
Also used : LocalDate(java.time.LocalDate) MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 53 with LocalDate

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

the class TCKLocalDate method test_plusWeeks_overMonths.

@Test
public void test_plusWeeks_overMonths() {
    LocalDate t = TEST_2007_07_15.plusWeeks(9);
    assertEquals(t, LocalDate.of(2007, 9, 16));
}
Also used : LocalDate(java.time.LocalDate) Test(org.testng.annotations.Test)

Example 54 with LocalDate

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

the class TCKLocalDate method test_toString.

@Test(dataProvider = "sampleToString")
public void test_toString(int y, int m, int d, String expected) {
    LocalDate t = LocalDate.of(y, m, d);
    String str = t.toString();
    assertEquals(str, expected);
}
Also used : LocalDate(java.time.LocalDate) Test(org.testng.annotations.Test)

Example 55 with LocalDate

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

the class TCKZonedDateTime method test_get.

@Test(dataProvider = "sampleTimes")
public void test_get(int y, int o, int d, int h, int m, int s, int n, ZoneId zone) {
    LocalDate localDate = LocalDate.of(y, o, d);
    LocalTime localTime = LocalTime.of(h, m, s, n);
    LocalDateTime localDateTime = LocalDateTime.of(localDate, localTime);
    ZoneOffset offset = zone.getRules().getOffset(localDateTime);
    ZonedDateTime a = ZonedDateTime.of(localDateTime, zone);
    assertEquals(a.getYear(), localDate.getYear());
    assertEquals(a.getMonth(), localDate.getMonth());
    assertEquals(a.getDayOfMonth(), localDate.getDayOfMonth());
    assertEquals(a.getDayOfYear(), localDate.getDayOfYear());
    assertEquals(a.getDayOfWeek(), localDate.getDayOfWeek());
    assertEquals(a.getHour(), localTime.getHour());
    assertEquals(a.getMinute(), localTime.getMinute());
    assertEquals(a.getSecond(), localTime.getSecond());
    assertEquals(a.getNano(), localTime.getNano());
    assertEquals(a.toLocalDate(), localDate);
    assertEquals(a.toLocalTime(), localTime);
    assertEquals(a.toLocalDateTime(), localDateTime);
    if (zone instanceof ZoneOffset) {
        assertEquals(a.toString(), localDateTime.toString() + offset.toString());
    } else {
        assertEquals(a.toString(), localDateTime.toString() + offset.toString() + "[" + zone.toString() + "]");
    }
}
Also used : LocalDateTime(java.time.LocalDateTime) LocalTime(java.time.LocalTime) ZonedDateTime(java.time.ZonedDateTime) LocalDate(java.time.LocalDate) ZoneOffset(java.time.ZoneOffset) Test(org.testng.annotations.Test)

Aggregations

LocalDate (java.time.LocalDate)1513 Test (org.junit.Test)472 Test (org.testng.annotations.Test)372 LocalDateTime (java.time.LocalDateTime)155 LocalTime (java.time.LocalTime)126 Date (java.util.Date)99 DateTimeFormatter (java.time.format.DateTimeFormatter)96 Ignore (org.junit.Ignore)94 ArrayList (java.util.ArrayList)87 BigDecimal (java.math.BigDecimal)69 Instant (java.time.Instant)56 ZonedDateTime (java.time.ZonedDateTime)55 Test (org.junit.jupiter.api.Test)54 List (java.util.List)50 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)46 HashMap (java.util.HashMap)44 Member (cz.metacentrum.perun.core.api.Member)41 ZoneId (java.time.ZoneId)40 TemporalField (java.time.temporal.TemporalField)40 Attribute (cz.metacentrum.perun.core.api.Attribute)39