use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class HourSerdeTest method testDeserializeOffsetDateTime.
@Test
public void testDeserializeOffsetDateTime() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 01, 00, 00);
Hour expectedDate = new Hour(localDate);
OffsetDateTime dateTime = OffsetDateTime.of(2020, 01, 01, 01, 00, 00, 00, ZoneOffset.UTC);
Serde serde = new Hour.HourSerde();
Object actualDate = serde.deserialize(dateTime);
assertEquals(expectedDate, actualDate);
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class HourSerdeTest method testDateSerialize.
@Test
public void testDateSerialize() {
String expected = "2020-01-01T01";
Hour expectedDate = new Hour(LocalDateTime.from(formatter.parse(expected)));
Serde serde = new Hour.HourSerde();
Object actual = serde.serialize(expectedDate);
assertEquals(expected, actual);
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class SecondSerdeTest method testDeserializeTimestamp.
@Test
public void testDeserializeTimestamp() {
String dateInString = "2020-01-01T01:18:19";
Second expectedDate = new Second(LocalDateTime.from(formatter.parse(dateInString)));
Timestamp timestamp = new Timestamp(expectedDate.getTime());
Serde serde = new Second.SecondSerde();
Object actualDate = serde.deserialize(timestamp);
assertEquals(expectedDate, actualDate);
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class TimeSerdeTest method testTimeDeserializeDate.
@Test
public void testTimeDeserializeDate() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Time expectedDate = new Time(localDate, true, true, true, false, false, false, (unused) -> "");
Serde serde = new Time.TimeSerde();
Object actualDate = serde.deserialize(DATE);
assertEquals(expectedDate, actualDate);
assertEquals(DATE, serde.serialize(actualDate));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class WeekSerdeTest method testDeserializeTimestamp.
@Test
public void testDeserializeTimestamp() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 05, 00, 00, 00);
Week expectedDate = new Week(localDate);
Timestamp timestamp = new Timestamp(expectedDate.getTime());
Serde serde = new Week.WeekSerde();
Object actualDate = serde.deserialize(timestamp);
assertEquals(expectedDate, actualDate);
}
Aggregations