From 2ad00c0dd7761db491b89c98bb959ed71abb9243 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Mon, 16 Jan 2017 17:27:42 +0100 Subject: [PATCH] DATAREST-982 - Adapt to changes in Jackson default time rendering in test case. We now configure a more explicit pattern to verify the ISO date rendering of Jackson. --- .../RepositoryRestMvConfigurationIntegrationTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java index 47754a8f3..faf5e7996 100644 --- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java +++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Locale; +import java.util.TimeZone; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -46,7 +47,6 @@ import org.springframework.data.rest.webmvc.alps.AlpsJsonHttpMessageConverter; import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module; import org.springframework.data.web.HateoasPageableHandlerMethodArgumentResolver; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; -import org.springframework.format.annotation.DateTimeFormat.ISO; import org.springframework.format.datetime.DateFormatter; import org.springframework.hateoas.LinkDiscoverers; import org.springframework.hateoas.MediaTypes; @@ -127,7 +127,8 @@ public class RepositoryRestMvConfigurationIntegrationTests { ObjectMapper mapper = context.getBean("objectMapper", ObjectMapper.class); DateFormatter formatter = new DateFormatter(); - formatter.setIso(ISO.DATE_TIME); + formatter.setPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + formatter.setTimeZone(TimeZone.getTimeZone("UTC")); Object result = JsonPath.read(mapper.writeValueAsString(sample), "$.date"); assertThat(result, is(instanceOf(String.class)));