use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class WeekSerdeTest method testDeserializeTimestampNotSunday.
@Test
public void testDeserializeTimestampNotSunday() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 06, 00, 00, 00);
Week expectedDate = new Week(localDate);
Serde serde = new Week.WeekSerde();
assertThrows(IllegalArgumentException.class, () -> serde.deserialize(expectedDate));
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class WeekSerdeTest method testDeserializeOffsetDateTime.
@Test
public void testDeserializeOffsetDateTime() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 05, 00, 00, 00);
Week expectedDate = new Week(localDate);
OffsetDateTime dateTime = OffsetDateTime.of(2020, 1, 5, 0, 0, 0, 0, ZoneOffset.UTC);
Serde serde = new Week.WeekSerde();
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 YearSerdeTest method testDeserializeTimestamp.
@Test
public void testDeserializeTimestamp() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Year expectedDate = new Year(localDate);
Timestamp timestamp = new Timestamp(expectedDate.getTime());
Serde serde = new Year.YearSerde();
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 YearSerdeTest method testDateSerialize.
@Test
public void testDateSerialize() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Year expectedDate = new Year(localDate);
Serde serde = new Year.YearSerde();
Object actual = serde.serialize(expectedDate);
assertEquals("2020", actual);
}
use of com.yahoo.elide.core.utils.coerce.converters.Serde in project elide by yahoo.
the class YearSerdeTest method testDeserializeOffsetDateTime.
@Test
public void testDeserializeOffsetDateTime() {
LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
Year expectedDate = new Year(localDate);
OffsetDateTime dateTime = OffsetDateTime.of(2020, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
Serde serde = new Year.YearSerde();
Object actualDate = serde.deserialize(dateTime);
assertEquals(expectedDate, actualDate);
}
Aggregations