use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class TimeSerdeTest method testTimeDeserializeMinute.
@Test
public void testTimeDeserializeMinute() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Time expectedDate = new Time(localDate, true, true, true, true, true, true, (unused) -> "");
Serde serde = new Time.TimeSerde();
Object actualDate = serde.deserialize(MINUTE);
assertEquals(expectedDate, actualDate);
assertEquals(MINUTE, serde.serialize(actualDate));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class TimeSerdeTest method testInvalidDeserialization.
@Test
public void testInvalidDeserialization() {
Serde serde = new Time.TimeSerde();
assertThrows(IllegalArgumentException.class, () -> serde.deserialize("2020R1"));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class TimeSerdeTest method testTimeDeserializeMonth.
@Test
public void testTimeDeserializeMonth() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Time expectedDate = new Time(localDate, true, true, false, false, false, false, (unused) -> "");
Serde serde = new Time.TimeSerde();
Object actualDate = serde.deserialize(MONTH);
assertEquals(expectedDate, actualDate);
assertEquals(MONTH, serde.serialize(actualDate));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class TimeSerdeTest method testTimeDeserializeYear.
@Test
public void testTimeDeserializeYear() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Time expectedDate = new Time(localDate, true, false, false, false, false, false, (unused) -> "");
Serde serde = new Time.TimeSerde();
Object actualDate = serde.deserialize(YEAR);
assertEquals(expectedDate, actualDate);
assertEquals(YEAR, serde.serialize(actualDate));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class WeekSerdeTest method testDateDeserializeString.
@Test
public void testDateDeserializeString() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 05, 00, 00, 00);
Week expectedDate = new Week(localDate);
Serde serde = new Week.WeekSerde();
Object actualDate = serde.deserialize("2020-01-05");
assertEquals(expectedDate, actualDate);
}
Aggregations