Search in sources :

Example 1 with OffsetDate

use of io.spine.time.OffsetDate in project core-java by SpineEventEngine.

the class TimeChangesShould method do_not_accept_equal_OffsetDate_values.

@Test(expected = IllegalArgumentException.class)
public void do_not_accept_equal_OffsetDate_values() {
    final ZoneOffset inLuxembourg = ZoneOffsets.ofHours(1);
    final OffsetDate date = OffsetDates.now(inLuxembourg);
    TimeChanges.of(date, date);
}
Also used : OffsetDate(io.spine.time.OffsetDate) ZoneOffset(io.spine.time.ZoneOffset) Test(org.junit.Test)

Example 2 with OffsetDate

use of io.spine.time.OffsetDate in project core-java by SpineEventEngine.

the class TimeChangesShould method do_not_accept_null_OffsetDate_newValue.

@Test(expected = NullPointerException.class)
public void do_not_accept_null_OffsetDate_newValue() {
    final ZoneOffset inKiev = ZoneOffsets.ofHours(3);
    final OffsetDate date = OffsetDates.now(inKiev);
    TimeChanges.of(date, null);
}
Also used : OffsetDate(io.spine.time.OffsetDate) ZoneOffset(io.spine.time.ZoneOffset) Test(org.junit.Test)

Example 3 with OffsetDate

use of io.spine.time.OffsetDate in project core-java by SpineEventEngine.

the class TimeChangesShould method do_not_accept_null_OffsetDate_previousValue.

@Test(expected = NullPointerException.class)
public void do_not_accept_null_OffsetDate_previousValue() {
    final ZoneOffset inLassVegas = ZoneOffsets.ofHours(8);
    final OffsetDate date = OffsetDates.now(inLassVegas);
    TimeChanges.of(null, date);
}
Also used : OffsetDate(io.spine.time.OffsetDate) ZoneOffset(io.spine.time.ZoneOffset) Test(org.junit.Test)

Example 4 with OffsetDate

use of io.spine.time.OffsetDate in project core-java by SpineEventEngine.

the class TimeChangesShould method create_OffsetDateChange_instance.

@Test
public void create_OffsetDateChange_instance() {
    final ZoneOffset inKiev = ZoneOffsets.ofHours(3);
    final ZoneOffset inLuxembourg = ZoneOffsets.ofHours(1);
    final OffsetDate previousDate = OffsetDates.now(inKiev);
    final OffsetDate newDate = OffsetDates.now(inLuxembourg);
    final OffsetDateChange result = TimeChanges.of(previousDate, newDate);
    assertEquals(previousDate, result.getPreviousValue());
    assertEquals(newDate, result.getNewValue());
}
Also used : OffsetDate(io.spine.time.OffsetDate) ZoneOffset(io.spine.time.ZoneOffset) Test(org.junit.Test)

Aggregations

OffsetDate (io.spine.time.OffsetDate)4 ZoneOffset (io.spine.time.ZoneOffset)4 Test (org.junit.Test)4