Search in sources :

Example 61 with Period

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

the class TCKPeriod method test_plusMonths_overflowTooBig.

@Test(expectedExceptions = ArithmeticException.class)
public void test_plusMonths_overflowTooBig() {
    Period test = Period.ofMonths(Integer.MAX_VALUE);
    test.plusMonths(1);
}
Also used : Period(java.time.Period) Test(org.testng.annotations.Test)

Example 62 with Period

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

the class TCKPeriod method test_equals_null.

public void test_equals_null() {
    Period test = Period.of(1, 2, 3);
    assertEquals(test.equals(null), false);
}
Also used : Period(java.time.Period)

Example 63 with Period

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

the class TCKPeriod method test_multipliedBy_overflowTooSmall.

@Test(expectedExceptions = ArithmeticException.class)
public void test_multipliedBy_overflowTooSmall() {
    Period test = Period.ofYears(Integer.MIN_VALUE / 2 - 1);
    test.multipliedBy(2);
}
Also used : Period(java.time.Period) Test(org.testng.annotations.Test)

Example 64 with Period

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

the class TCKPeriod method test_plusYears_overflowTooBig.

@Test(expectedExceptions = ArithmeticException.class)
public void test_plusYears_overflowTooBig() {
    Period test = Period.ofYears(Integer.MAX_VALUE);
    test.plusYears(1);
}
Also used : Period(java.time.Period) Test(org.testng.annotations.Test)

Example 65 with Period

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

the class TCKPeriod method test_plusDays_overflowTooSmall.

@Test(expectedExceptions = ArithmeticException.class)
public void test_plusDays_overflowTooSmall() {
    Period test = Period.ofDays(Integer.MIN_VALUE);
    test.plusDays(-1);
}
Also used : Period(java.time.Period) Test(org.testng.annotations.Test)

Aggregations

Period (java.time.Period)110 Test (org.junit.Test)37 Test (org.testng.annotations.Test)27 LocalDate (java.time.LocalDate)21 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)8 Duration (java.time.Duration)8 LocalDateTime (java.time.LocalDateTime)7 ZonedDateTime (java.time.ZonedDateTime)7 DateTimeFormatter (java.time.format.DateTimeFormatter)6 Date (java.util.Date)6 Instant (java.time.Instant)5 LocalTime (java.time.LocalTime)5 ZoneId (java.time.ZoneId)5 Test (org.junit.jupiter.api.Test)5 DateTimeParseException (java.time.format.DateTimeParseException)4 TemporalAmount (java.time.temporal.TemporalAmount)4 Arrays (java.util.Arrays)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 OffsetTime (java.time.OffsetTime)3