Search in sources :

Example 91 with Period

use of java.time.Period in project j2objc by google.

the class TCKPeriod method test_plusMonths_overflowTooSmall.

@Test(expected = ArithmeticException.class)
public void test_plusMonths_overflowTooSmall() {
    Period test = Period.ofMonths(Integer.MIN_VALUE);
    test.plusMonths(-1);
}
Also used : Period(java.time.Period) Test(org.junit.Test)

Example 92 with Period

use of java.time.Period in project j2objc by google.

the class TCKPeriod method test_Period_getUnits.

// -----------------------------------------------------------------------
// get units
// -----------------------------------------------------------------------
@Test
public void test_Period_getUnits() {
    Period period = Period.of(2012, 1, 1);
    List<TemporalUnit> units = period.getUnits();
    assertEquals("Period.getUnits should return 3 units", units.size(), 3);
    assertEquals("Period.getUnits contains ChronoUnit.YEARS", units.get(0), ChronoUnit.YEARS);
    assertEquals("Period.getUnits contains ChronoUnit.MONTHS", units.get(1), ChronoUnit.MONTHS);
    assertEquals("Period.getUnits contains ChronoUnit.DAYS", units.get(2), ChronoUnit.DAYS);
}
Also used : TemporalUnit(java.time.temporal.TemporalUnit) Period(java.time.Period) Test(org.junit.Test)

Example 93 with Period

use of java.time.Period in project j2objc by google.

the class TCKPeriod method test_minusYears_overflowTooSmall.

@Test(expected = ArithmeticException.class)
public void test_minusYears_overflowTooSmall() {
    Period test = Period.ofYears(Integer.MIN_VALUE);
    test.minusYears(1);
}
Also used : Period(java.time.Period) Test(org.junit.Test)

Example 94 with Period

use of java.time.Period in project j2objc by google.

the class TCKPeriod method test_minusDays_overflowTooSmall.

@Test(expected = ArithmeticException.class)
public void test_minusDays_overflowTooSmall() {
    Period test = Period.ofDays(Integer.MIN_VALUE);
    test.minusDays(1);
}
Also used : Period(java.time.Period) Test(org.junit.Test)

Example 95 with Period

use of java.time.Period in project j2objc by google.

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)

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