use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class ISOWeekSerdeTest method testDeserializeOffsetDateTimeNotMonday.
@Test
public void testDeserializeOffsetDateTimeNotMonday() {
OffsetDateTime dateTime = OffsetDateTime.of(2020, 01, 01, 00, 00, 00, 00, ZoneOffset.UTC);
Serde serde = new ISOWeek.ISOWeekSerde();
assertThrows(IllegalArgumentException.class, () -> serde.deserialize(dateTime));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class ISOWeekSerdeTest method testDateSerialize.
@Test
public void testDateSerialize() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 06, 00, 00, 00);
ISOWeek expectedDate = new ISOWeek(localDate);
Serde serde = new ISOWeek.ISOWeekSerde();
Object actual = serde.serialize(expectedDate);
assertEquals("2020-01-06", actual);
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class MinuteSerdeTest method testDateSerialize.
@Test
public void testDateSerialize() {
String expected = "2020-01-01T01:18";
Minute expectedDate = new Minute(LocalDateTime.from(formatter.parse(expected)));
Serde serde = new Minute.MinuteSerde();
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 MonthSerdeTest method testDeserializeOffsetDateTime.
@Test
public void testDeserializeOffsetDateTime() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Month expectedDate = new Month(localDate);
OffsetDateTime dateTime = OffsetDateTime.of(2020, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
Serde serde = new Month.MonthSerde();
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 MonthSerdeTest method testDeserializeTimestamp.
@Test
public void testDeserializeTimestamp() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Month expectedDate = new Month(localDate);
Timestamp timestamp = new Timestamp(expectedDate.getTime());
Serde serde = new Month.MonthSerde();
Object actualDate = serde.deserialize(timestamp);
assertEquals(expectedDate, actualDate);
}
Aggregations