use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class DaySerdeTest method testDeserializeDateInvalidFormat.
@Test
public void testDeserializeDateInvalidFormat() {
String dateInString = "January-01-2020";
Serde serde = new Day.DaySerde();
assertThrows(DateTimeParseException.class, () -> serde.deserialize(dateInString));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class DaySerdeTest method testDeserializeTimestamp.
@Test
public void testDeserializeTimestamp() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Day expectedDate = new Day(localDate);
Timestamp timestamp = new Timestamp(expectedDate.getTime());
Serde serde = new Day.DaySerde();
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 HourSerdeTest method testDeserializeDateInvalidFormat.
@Test
public void testDeserializeDateInvalidFormat() {
String dateInString = "00 2020-01-01";
Serde serde = new Hour.HourSerde();
assertThrows(DateTimeParseException.class, () -> serde.deserialize(dateInString));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class ISOWeekSerdeTest method testDeserializeTimestampNotMonday.
@Test
public void testDeserializeTimestampNotMonday() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
ISOWeek timestamp = new ISOWeek(localDate);
Serde serde = new ISOWeek.ISOWeekSerde();
assertThrows(IllegalArgumentException.class, () -> serde.deserialize(timestamp));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class ISOWeekSerdeTest method testDeserializeDateInvalidFormat.
@Test
public void testDeserializeDateInvalidFormat() {
String dateInString = "January-2020-01";
Serde serde = new ISOWeek.ISOWeekSerde();
assertThrows(DateTimeParseException.class, () -> serde.deserialize(dateInString));
}
Aggregations