Search in sources :

Example 1 with Timestamps2.toDate

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

the class Timestamps2Should method convert_timestamp_to_date_to_nearest_second.

@Test
public void convert_timestamp_to_date_to_nearest_second() {
    final Timestamp expectedTime = getCurrentTime();
    final Date actualDate = toDate(expectedTime);
    final long actualSeconds = actualDate.getTime() / MILLIS_PER_SECOND;
    assertEquals(expectedTime.getSeconds(), actualSeconds);
}
Also used : Timestamp(com.google.protobuf.Timestamp) Date(java.util.Date) Timestamps2.toDate(io.spine.time.Timestamps2.toDate) Test(org.junit.Test)

Aggregations

Timestamp (com.google.protobuf.Timestamp)1 Timestamps2.toDate (io.spine.time.Timestamps2.toDate)1 Date (java.util.Date)1 Test (org.junit.Test)1