use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampZonedDateTimeDeserializerTest method testDeserializationAsIonTimestamp04UnknownOffset.
@Test
public void testDeserializationAsIonTimestamp04UnknownOffset() throws Exception {
ZonedDateTime expected = ZonedDateTime.now(UTC);
Timestamp timestamp = TimestampUtils.toTimestamp(expected.toInstant(), null);
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 testDeserializationAsIonTimestamp03NonUTCTimeOffset.
@Test
public void testDeserializationAsIonTimestamp03NonUTCTimeOffset() throws Exception {
ZonedDateTime expected = ZonedDateTime.now(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 testDeserializationWithTypeInfo04.
@Test
public void testDeserializationWithTypeInfo04() throws Exception {
Instant now = Instant.now();
ZonedDateTime expected = ZonedDateTime.ofInstant(now, UTC);
IonObjectMapper m = newMapperBuilder().addMixIn(Temporal.class, MockObjectConfiguration.class).build();
Timestamp timestamp = TimestampUtils.toTimestamp(now, ZoneOffset.UTC);
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 testDeserializationAsIonTimestamp04UnknownOffsetNonUTCDefault.
@Test
public void testDeserializationAsIonTimestamp04UnknownOffsetNonUTCDefault() throws Exception {
ZonedDateTime expected = ZonedDateTime.now(Z1);
Timestamp timestamp = TimestampUtils.toTimestamp(expected.toInstant(), null);
ZonedDateTime actual = READER_Z1_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 testDeserializationAsIonTimestamp01NonUTCTimeOffset.
@Test
public void testDeserializationAsIonTimestamp01NonUTCTimeOffset() throws Exception {
ZonedDateTime expected = ZonedDateTime.ofInstant(Instant.ofEpochSecond(0L), 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);
}
Aggregations