Search in sources :

Example 1 with OffsetTime

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

the class TimeChangesShould method create_OffsetTimeChange_instance.

@Test
public void create_OffsetTimeChange_instance() {
    final ZoneOffset inKiev = ZoneOffsets.ofHours(3);
    final ZoneOffset inLuxembourg = ZoneOffsets.ofHours(1);
    final OffsetTime previousTime = OffsetTimes.now(inKiev);
    final OffsetTime newTime = OffsetTimes.now(inLuxembourg);
    final OffsetTimeChange result = TimeChanges.of(previousTime, newTime);
    assertEquals(previousTime, result.getPreviousValue());
    assertEquals(newTime, result.getNewValue());
}
Also used : OffsetTime(io.spine.time.OffsetTime) ZoneOffset(io.spine.time.ZoneOffset) Test(org.junit.Test)

Example 2 with OffsetTime

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

the class TimeChangesShould method do_not_accept_null_OffsetTime_newValue.

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

Example 3 with OffsetTime

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

the class TimeChangesShould method do_not_accept_null_OffsetTime_previousValue.

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

Example 4 with OffsetTime

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

the class TimeChangesShould method do_not_accept_equal_OffsetTime_values.

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

Aggregations

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