Search in sources :

Example 6 with ZoneOffset

use of io.spine.time.ZoneOffset 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 7 with ZoneOffset

use of io.spine.time.ZoneOffset 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 8 with ZoneOffset

use of io.spine.time.ZoneOffset 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 9 with ZoneOffset

use of io.spine.time.ZoneOffset 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 10 with ZoneOffset

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

the class CommandFactoryShould method create_command_context.

@Test
public void create_command_context() {
    final TenantId tenantId = GivenTenantId.newUuid();
    final UserId userId = GivenUserId.newUuid();
    final ZoneOffset zoneOffset = ZoneOffsets.ofHours(-3);
    final int targetVersion = 100500;
    final CommandContext commandContext = CommandFactory.createContext(tenantId, userId, zoneOffset, targetVersion);
    final ActorContext actorContext = commandContext.getActorContext();
    assertEquals(tenantId, actorContext.getTenantId());
    assertEquals(userId, actorContext.getActor());
    assertEquals(zoneOffset, actorContext.getZoneOffset());
    assertEquals(targetVersion, commandContext.getTargetVersion());
}
Also used : TenantId(io.spine.core.TenantId) GivenTenantId(io.spine.core.given.GivenTenantId) CommandContext(io.spine.core.CommandContext) UserId(io.spine.core.UserId) GivenUserId(io.spine.core.given.GivenUserId) ZoneOffset(io.spine.time.ZoneOffset) ActorContext(io.spine.core.ActorContext) Test(org.junit.Test)

Aggregations

ZoneOffset (io.spine.time.ZoneOffset)30 Test (org.junit.Test)29 OffsetDate (io.spine.time.OffsetDate)8 OffsetDateTime (io.spine.time.OffsetDateTime)8 OffsetTime (io.spine.time.OffsetTime)8 Timestamp (com.google.protobuf.Timestamp)1 ActorContext (io.spine.core.ActorContext)1 CommandContext (io.spine.core.CommandContext)1 TenantId (io.spine.core.TenantId)1 UserId (io.spine.core.UserId)1 GivenTenantId (io.spine.core.given.GivenTenantId)1 GivenUserId (io.spine.core.given.GivenUserId)1 ParseException (java.text.ParseException)1 TimeZone (java.util.TimeZone)1