use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampZonedDateTimeDeserializerTest method testDeserializationWithTypeInfo04NonUTCOffset.
@Test
public void testDeserializationWithTypeInfo04NonUTCOffset() throws Exception {
Instant now = Instant.now();
ZonedDateTime expected = ZonedDateTime.ofInstant(now, Z1);
IonObjectMapper m = newMapperBuilder().addMixIn(Temporal.class, MockObjectConfiguration.class).build();
Timestamp timestamp = TimestampUtils.toTimestamp(now, expected.getOffset());
Temporal actual = m.readValue("[\"" + ZonedDateTime.class.getName() + "\"," + timestamp.toString() + "]", Temporal.class);
assertTrue("The value should be an ZonedDateTime.", actual instanceof ZonedDateTime);
assertEquals("The value is not correct.", expected, actual);
}
use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampZonedDateTimeDeserializerTest method testDeserializationAsIonTimestamp02NonUTCTimeOffset.
@Test
public void testDeserializationAsIonTimestamp02NonUTCTimeOffset() throws Exception {
ZonedDateTime expected = ZonedDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z1);
Timestamp timestamp = TimestampUtils.toTimestamp(expected.toInstant(), expected.getOffset());
ZonedDateTime actual = READER_UTC_DEFAULT.readValue(timestamp.toString());
assertEquals("The value is not correct.", expected, actual);
}
use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampZonedDateTimeDeserializerTest method testDeserializationAsIonTimestamp01.
/*
**********************************************************************
* Deserialization from Ion timestamp value
**********************************************************************
*/
@Test
public void testDeserializationAsIonTimestamp01() throws Exception {
ZonedDateTime expected = ZonedDateTime.ofInstant(Instant.ofEpochSecond(0L), UTC);
Timestamp timestamp = TimestampUtils.toTimestamp(expected.toInstant(), expected.getOffset());
ZonedDateTime actual = READER_UTC_DEFAULT.readValue(timestamp.toString());
assertEquals("The value is not correct.", expected, actual);
}
use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampZonedDateTimeDeserializerTest method testDeserializationAsIonTimestamp03.
@Test
public void testDeserializationAsIonTimestamp03() throws Exception {
ZonedDateTime expected = ZonedDateTime.now(UTC);
Timestamp timestamp = TimestampUtils.toTimestamp(expected.toInstant(), expected.getOffset());
ZonedDateTime actual = READER_UTC_DEFAULT.readValue(timestamp.toString());
assertEquals("The value is not correct.", expected, actual);
}
use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampOffsetDateTimeDeserializerTest method testDeserializationAsIonTimestamp04UnknownOffset.
@Test
public void testDeserializationAsIonTimestamp04UnknownOffset() throws Exception {
OffsetDateTime expected = OffsetDateTime.now(UTC);
Timestamp timestamp = TimestampUtils.toTimestamp(expected.toInstant(), null);
OffsetDateTime actual = READER_UTC_DEFAULT.readValue(timestamp.toString());
assertEquals("The value is not correct.", expected, actual);
}
Aggregations