parent
cd7e5f61f0
commit
7b6293fa05
|
@ -355,7 +355,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
|||
|
||||
@Test
|
||||
public 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);
|
||||
|
@ -551,7 +551,6 @@ public class Jackson2ObjectMapperBuilderTests {
|
|||
assertThat(objectMapper.getFactory().getClass()).isEqualTo(SmileFactory.class);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void visibility() throws JsonProcessingException {
|
||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
||||
|
@ -565,6 +564,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
|||
assertThat(json).doesNotContain("property3");
|
||||
}
|
||||
|
||||
|
||||
public static class CustomIntegerModule extends Module {
|
||||
|
||||
@Override
|
||||
|
@ -651,6 +651,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static class JacksonVisibilityBean {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -661,9 +662,9 @@ public class Jackson2ObjectMapperBuilderTests {
|
|||
public String getProperty3() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static class OffsetDateTimeDeserializer extends JsonDeserializer<OffsetDateTime> {
|
||||
|
||||
private static final String CURRENT_ZONE_OFFSET = OffsetDateTime.now().getOffset().toString();
|
||||
|
@ -684,6 +685,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@JsonDeserialize
|
||||
static class DemoPojo {
|
||||
|
||||
|
@ -696,13 +698,14 @@ public class Jackson2ObjectMapperBuilderTests {
|
|||
public void setOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
this.offsetDateTime = offsetDateTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class MyXmlFactory extends XmlFactory {
|
||||
}
|
||||
|
||||
|
||||
static class Foo {}
|
||||
|
||||
static class Bar {}
|
||||
|
|
|
@ -213,7 +213,6 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test // SPR-12634
|
||||
@SuppressWarnings("unchecked")
|
||||
public void customizeDefaultModulesWithModuleClass() throws JsonProcessingException, UnsupportedEncodingException {
|
||||
this.factory.setModulesToInstall(CustomIntegerModule.class);
|
||||
this.factory.afterPropertiesSet();
|
||||
|
@ -262,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;
|
||||
|
|
Loading…
Reference in New Issue