Search in sources :

Example 1 with OffsetDateTime

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

the class TimeChangesShould method do_not_accept_null_OffsetDateTime_previousValue.

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

Example 2 with OffsetDateTime

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

the class TimeChangesShould method create_OffsetDateTimeChange_instance.

@Test
public void create_OffsetDateTimeChange_instance() {
    final ZoneOffset inKiev = ZoneOffsets.ofHours(3);
    final ZoneOffset inLuxembourg = ZoneOffsets.ofHours(1);
    final OffsetDateTime previousDateTime = OffsetDateTimes.now(inKiev);
    final OffsetDateTime newDateTime = OffsetDateTimes.now(inLuxembourg);
    final OffsetDateTimeChange result = TimeChanges.of(previousDateTime, newDateTime);
    assertEquals(previousDateTime, result.getPreviousValue());
    assertEquals(newDateTime, result.getNewValue());
}
Also used : OffsetDateTime(io.spine.time.OffsetDateTime) ZoneOffset(io.spine.time.ZoneOffset) Test(org.junit.Test)

Example 3 with OffsetDateTime

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

the class TimeChangesShould method do_not_accept_equal_OffsetDateTime_values.

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

Example 4 with OffsetDateTime

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

the class TimeChangesShould method do_not_accept_null_OffsetDateTime_newValue.

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

Aggregations

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