Compatibility with Jackson 2.12 (tested against 2.12.0-rc1)
Closes gh-25907
This commit is contained in:
@@ -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 {
|
||||
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 {
|
||||
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 {
|
||||
assertThat(objectMapper.getFactory().getClass()).isEqualTo(SmileFactory.class);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void visibility() throws JsonProcessingException {
|
||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
||||
@@ -578,6 +576,7 @@ class Jackson2ObjectMapperBuilderTests {
|
||||
assertThat(json).doesNotContain("property3");
|
||||
}
|
||||
|
||||
|
||||
static class CustomIntegerModule extends Module {
|
||||
|
||||
@Override
|
||||
@@ -664,6 +663,7 @@ class Jackson2ObjectMapperBuilderTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class JacksonVisibilityBean {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@JsonDeserialize
|
||||
static class DemoPojo {
|
||||
|
||||
@@ -709,7 +710,6 @@ class Jackson2ObjectMapperBuilderTests {
|
||||
public void setOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
this.offsetDateTime = offsetDateTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
|
||||
@@ -261,7 +261,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
||||
|
||||
@Test
|
||||
public void propertyNamingStrategy() {
|
||||
PropertyNamingStrategy strategy = new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy();
|
||||
PropertyNamingStrategy strategy = new PropertyNamingStrategy.SnakeCaseStrategy();
|
||||
this.factory.setPropertyNamingStrategy(strategy);
|
||||
this.factory.afterPropertiesSet();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,7 +46,6 @@ import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
||||
import com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -202,11 +201,6 @@ public class SpringHandlerInstantiatorTests {
|
||||
return JsonTypeInfo.Id.CUSTOM;
|
||||
}
|
||||
|
||||
// Only needed when compiling against Jackson 2.7; gone in 2.8
|
||||
public JavaType typeFromId(String s) {
|
||||
return TypeFactory.defaultInstance().constructFromCanonical(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String idFromValue(Object value) {
|
||||
isAutowiredFiledInitialized = (this.capitalizer != null);
|
||||
@@ -227,7 +221,6 @@ public class SpringHandlerInstantiatorTests {
|
||||
return null;
|
||||
}
|
||||
|
||||
// New in Jackson 2.7
|
||||
@Override
|
||||
public String getDescForKnownTypeIds() {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user