use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampInstantDeserializerTest method testDeserializationAsIonTimestamp01.
/*
**********************************************************************
* Deserialization from Ion timestamp actual
**********************************************************************
*/
@Test
public void testDeserializationAsIonTimestamp01() throws Exception {
Instant expected = Instant.ofEpochSecond(0L);
Timestamp timestamp = TimestampUtils.toTimestamp(expected, ZoneOffset.UTC);
Instant actual = READER.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 IonTimestampInstantDeserializerTest method testDeserializationFromStringWithNonZeroOffset01.
@Test
public void testDeserializationFromStringWithNonZeroOffset01() throws Exception {
Instant expected = Instant.now();
Timestamp timestamp = TimestampUtils.toTimestamp(expected, ZoneOffset.ofHours(8));
Instant result = READER.readValue(timestamp.toString());
assertEquals("The value is not correct.", expected, result);
}
use of com.amazon.ion.Timestamp in project jackson-dataformats-binary by FasterXML.
the class IonTimestampInstantDeserializerTest method testDeserializationAsIonTimestamp02.
@Test
public void testDeserializationAsIonTimestamp02() throws Exception {
Instant expected = Instant.ofEpochSecond(123456789L, 183917322);
Timestamp timestamp = TimestampUtils.toTimestamp(expected, ZoneOffset.UTC);
Instant actual = READER.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 IonTimestampInstantDeserializerTest method testDeserializationAsIonTimestamp03.
@Test
public void testDeserializationAsIonTimestamp03() throws Exception {
Instant expected = Instant.now();
Timestamp timestamp = TimestampUtils.toTimestamp(expected, ZoneOffset.UTC);
Instant actual = READER.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 IonTimestampInstantSerializerTest method testSerializationAsString03.
@Test
public void testSerializationAsString03() throws Exception {
IonObjectMapper mapper = newMapperBuilder().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).build();
Instant date = Instant.now();
Timestamp value = ((IonTimestamp) mapper.writeValueAsIonValue(date)).timestampValue();
assertEquals("The value is not correct.", TimestampUtils.toTimestamp(date, ZoneOffset.UTC), value);
}
Aggregations