List of usage examples for org.springframework.format.datetime DateFormatter setIso
public void setIso(ISO iso)
From source file:org.springframework.data.rest.webmvc.config.RepositoryRestMvConfigurationIntegrationTests.java
/** * @see DATAREST-336/*from w ww . j a v a2 s. co m*/ */ @Test public void objectMapperRendersDatesInIsoByDefault() throws Exception { Sample sample = new Sample(); sample.date = new Date(); ObjectMapper mapper = context.getBean("objectMapper", ObjectMapper.class); DateFormatter formatter = new DateFormatter(); formatter.setIso(ISO.DATE_TIME); Object result = JsonPath.read(mapper.writeValueAsString(sample), "$.date"); assertThat(result, is(instanceOf(String.class))); assertThat(result, is((Object) formatter.print(sample.date, Locale.US))); }