use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class TestCommandContextFactory method createCommandContext.
/** Creates a new {@link CommandContext} instance. */
public static CommandContext createCommandContext() {
final UserId userId = newUserId(newUuid());
final Timestamp now = getCurrentTime();
return createCommandContext(userId, now);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Timestamps2Should method reset_time_provider_to_default.
@Test
public void reset_time_provider_to_default() {
final Timestamp aMinuteAgo = subtract(systemTime(), fromMinutes(1));
setProvider(new TimeTests.FrozenMadHatterParty(aMinuteAgo));
resetProvider();
assertNotEquals(aMinuteAgo, getCurrentTime());
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Timestamps2Should method compare_two_timestamps_return_negative_int_if_first_is_null.
@Test
public void compare_two_timestamps_return_negative_int_if_first_is_null() {
final Timestamp currentTime = getCurrentTime();
final int result = compare(null, currentTime);
assertTrue(result < 0);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Timestamps2Should method calculate_timestamp_of_moment_minute_ago.
@Test
public void calculate_timestamp_of_moment_minute_ago() {
final Timestamp currentTime = getCurrentTime();
final Timestamp expected = subtract(currentTime, MINUTE);
final Timestamp actual = TimeTests.Past.minutesAgo(1);
assertEquals(expected.getSeconds(), actual.getSeconds());
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Timestamps2Should method compare_two_timestamps_using_comparator_return_zero_if_timestamps_are_equal.
@Test
public void compare_two_timestamps_using_comparator_return_zero_if_timestamps_are_equal() {
final int secs = 256;
final int nanos = 512;
final Timestamp time1 = Timestamp.newBuilder().setSeconds(secs).setNanos(nanos).build();
final Timestamp time2 = Timestamp.newBuilder().setSeconds(secs).setNanos(nanos).build();
final int result = Timestamps.comparator().compare(time1, time2);
assertEquals(0, result);
}
Aggregations