DATACMNS-1243 - Add converters from LocalDateTime to Instant and back.
This allows usage of Instant for AuditAware. Original pull request: #268.
This commit is contained in:
committed by
Oliver Gierke
parent
af9b64ff00
commit
58b0cc9c0a
@@ -145,6 +145,17 @@ public class Jsr310ConvertersUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1243
|
||||
public void convertsLocalDateTimeToInstantAndBack() {
|
||||
|
||||
LocalDateTime dateTime = LocalDateTime.now();
|
||||
|
||||
Instant instant = CONVERSION_SERVICE.convert(dateTime, Instant.class);
|
||||
LocalDateTime convertedDateTime = CONVERSION_SERVICE.convert(dateTime, LocalDateTime.class);
|
||||
|
||||
assertThat(convertedDateTime).isEqualTo(dateTime);
|
||||
}
|
||||
|
||||
private static Predicate<Date> formatted(Temporal expected, String format) {
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
||||
|
||||
Reference in New Issue
Block a user