fix deprecation warning of Jackson ISO8601DateFormat

This commit is contained in:
Sebastian Sdorra
2020-02-04 15:27:30 +01:00
parent 00b5471ca7
commit a36551597d
2 changed files with 26 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
package sonia.scm.api.rest;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.jupiter.api.Test;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import static org.assertj.core.api.Assertions.assertThat;
class ObjectMapperProviderTest {
private final ObjectMapperProvider provider = new ObjectMapperProvider();
@Test
void shouldFormatInstantAsISO8601() throws JsonProcessingException {
ZoneId zone = ZoneId.of("Europe/Berlin");
ZonedDateTime date = ZonedDateTime.of(2020, 2, 4, 15, 21, 42, 0, zone);
String value = provider.get().writeValueAsString(date.toInstant());
assertThat(value).isEqualTo("\"2020-02-04T14:21:42Z\"");
}
}