mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-26 02:30:39 -06:00
add illustrative test for EpochMillisToJavaLocalDate
This commit is contained in:
parent
51459d7286
commit
735b32e19a
@ -0,0 +1,27 @@
|
||||
package io.nosqlbench.activitytype.cql.datamappers.functions.long_localdate;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class EpochMillisToJavaLocalDateTest {
|
||||
|
||||
@Test
|
||||
public void testDayAt2020Start() {
|
||||
EpochMillisToJavaLocalDate func = new EpochMillisToJavaLocalDate();
|
||||
LocalDate v1 = func.apply(0);
|
||||
LocalDate zerodate = LocalDate.ofInstant(Instant.ofEpochMilli(0), ZoneId.systemDefault());
|
||||
assertThat(v1).isEqualTo(zerodate);
|
||||
|
||||
LocalDate v2 = func.apply(533664000002000L);
|
||||
DateTime dt2 = new DateTime(533664000002000L);
|
||||
LocalDate d2instant = LocalDate.ofInstant(Instant.ofEpochMilli(533664000002000L), ZoneId.systemDefault());
|
||||
assertThat(v2).isEqualTo(d2instant);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user