|
|
|
@ -354,7 +354,7 @@ class Jackson2ObjectMapperBuilderTests {
@@ -354,7 +354,7 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void propertyNamingStrategy() { |
|
|
|
|
PropertyNamingStrategy strategy = new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy(); |
|
|
|
|
PropertyNamingStrategy strategy = new PropertyNamingStrategy.SnakeCaseStrategy(); |
|
|
|
|
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().propertyNamingStrategy(strategy).build(); |
|
|
|
|
assertThat(objectMapper.getSerializationConfig().getPropertyNamingStrategy()).isSameAs(strategy); |
|
|
|
|
assertThat(objectMapper.getDeserializationConfig().getPropertyNamingStrategy()).isSameAs(strategy); |
|
|
|
@ -430,9 +430,8 @@ class Jackson2ObjectMapperBuilderTests {
@@ -430,9 +430,8 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
assertThat(output).doesNotContain("value2"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // gh-23017
|
|
|
|
|
@Test // gh-23017
|
|
|
|
|
void postConfigurer() { |
|
|
|
|
|
|
|
|
|
JacksonAnnotationIntrospector introspector1 = new JacksonAnnotationIntrospector(); |
|
|
|
|
JacksonAnnotationIntrospector introspector2 = new JacksonAnnotationIntrospector(); |
|
|
|
|
|
|
|
|
@ -456,7 +455,7 @@ class Jackson2ObjectMapperBuilderTests {
@@ -456,7 +455,7 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
JsonSerializer<Number> serializer2 = new NumberSerializer(Integer.class); |
|
|
|
|
|
|
|
|
|
Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json() |
|
|
|
|
.modules(new ArrayList<>()) // Disable well-known modules detection
|
|
|
|
|
.modules(new ArrayList<>()) // Disable well-known modules detection
|
|
|
|
|
.serializers(serializer1) |
|
|
|
|
.serializersByType(Collections.singletonMap(Boolean.class, serializer2)) |
|
|
|
|
.deserializersByType(deserializerMap) |
|
|
|
@ -564,7 +563,6 @@ class Jackson2ObjectMapperBuilderTests {
@@ -564,7 +563,6 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
assertThat(objectMapper.getFactory().getClass()).isEqualTo(SmileFactory.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void visibility() throws JsonProcessingException { |
|
|
|
|
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json() |
|
|
|
@ -578,6 +576,7 @@ class Jackson2ObjectMapperBuilderTests {
@@ -578,6 +576,7 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
assertThat(json).doesNotContain("property3"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static class CustomIntegerModule extends Module { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -664,6 +663,7 @@ class Jackson2ObjectMapperBuilderTests {
@@ -664,6 +663,7 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static class JacksonVisibilityBean { |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
@ -674,9 +674,9 @@ class Jackson2ObjectMapperBuilderTests {
@@ -674,9 +674,9 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
public String getProperty3() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static class OffsetDateTimeDeserializer extends JsonDeserializer<OffsetDateTime> { |
|
|
|
|
|
|
|
|
|
private static final String CURRENT_ZONE_OFFSET = OffsetDateTime.now().getOffset().toString(); |
|
|
|
@ -697,6 +697,7 @@ class Jackson2ObjectMapperBuilderTests {
@@ -697,6 +697,7 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JsonDeserialize |
|
|
|
|
static class DemoPojo { |
|
|
|
|
|
|
|
|
@ -709,7 +710,6 @@ class Jackson2ObjectMapperBuilderTests {
@@ -709,7 +710,6 @@ class Jackson2ObjectMapperBuilderTests {
|
|
|
|
|
public void setOffsetDateTime(OffsetDateTime offsetDateTime) { |
|
|
|
|
this.offsetDateTime = offsetDateTime; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("serial") |
|
|
|
|