|
|
|
@ -381,6 +381,7 @@ public class JacksonAutoConfigurationTests {
|
|
|
|
|
"spring.jackson.time-zone:America/Los_Angeles");
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context,
|
|
|
|
|
"spring.jackson.date-format:zzzz");
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context, "spring.jackson.locale:en");
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
ObjectMapper objectMapper = this.context.getBean(
|
|
|
|
|
Jackson2ObjectMapperBuilder.class).build();
|
|
|
|
@ -402,6 +403,21 @@ public class JacksonAutoConfigurationTests {
|
|
|
|
|
assertEquals("\"GMT+10:00\"", objectMapper.writeValueAsString(date));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void customLocale() throws JsonProcessingException {
|
|
|
|
|
this.context.register(JacksonAutoConfiguration.class);
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context, "spring.jackson.locale:de");
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context,
|
|
|
|
|
"spring.jackson.date-format:zzzz");
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
ObjectMapper objectMapper = this.context
|
|
|
|
|
.getBean(Jackson2ObjectMapperBuilder.class).build();
|
|
|
|
|
|
|
|
|
|
DateTime dateTime = new DateTime(1436966242231L, DateTimeZone.UTC);
|
|
|
|
|
assertEquals("\"Koordinierte Universalzeit\"",
|
|
|
|
|
objectMapper.writeValueAsString(dateTime));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
protected static class MockObjectMapperConfig {
|
|
|
|
|
|
|
|
|
|