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