use of org.apache.logging.log4j.core.time.Instant in project logging-log4j2 by apache.
the class InstantAttributeConverterTest method testConvert01.
@Test
public void testConvert01() {
final MutableInstant instant = new MutableInstant();
instant.initFromEpochSecond(1234567, 89012);
final String converted = this.converter.convertToDatabaseColumn(instant);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.", "1234567,89012", converted);
final Instant reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("epoch sec", 1234567, reversed.getEpochSecond());
assertEquals("nanoOfSecond", 89012, reversed.getNanoOfSecond());
}
Aggregations