Skip to content

Commit d72cf16

Browse files
committed
warnings clean up
1 parent 19335ea commit d72cf16

File tree

6 files changed

+31
-16
lines changed

6 files changed

+31
-16
lines changed

afterburner/src/test/java/com/fasterxml/jackson/module/afterburner/util/MyClassLoaderWithArtificialTiming.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
/**
66
* An extension of MyClassLoader with controllable blocking behavior of the
7-
* {@link #defineClassOnParent(ClassLoader, String, byte[], int, int)} method, allowing the interleaving of threads
7+
* {@code defineClassOnParent(ClassLoader, String, byte[], int, int)} method,
8+
* allowing the interleaving of threads
89
* through {@link #loadAndResolve(ClassName, byte[])} to be controlled by an external test harness.
910
*/
1011
public class MyClassLoaderWithArtificialTiming extends MyClassLoader {

jaxb/src/test/java/com/fasterxml/jackson/module/jaxb/BaseJaxbTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import java.util.Map;
55

66
import com.fasterxml.jackson.databind.*;
7+
import com.fasterxml.jackson.databind.cfg.MapperBuilder;
78
import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair;
89
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
9-
10+
import com.fasterxml.jackson.databind.json.JsonMapper;
1011
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
1112

1213
public abstract class BaseJaxbTest
@@ -34,6 +35,13 @@ protected ObjectMapper getJaxbMapper()
3435
return mapper;
3536
}
3637

38+
@SuppressWarnings("deprecation")
39+
protected MapperBuilder<?,?> getJaxbMapperBuilder()
40+
{
41+
return JsonMapper.builder()
42+
.annotationIntrospector(new JaxbAnnotationIntrospector());
43+
}
44+
3745
protected ObjectMapper getJaxbAndJacksonMapper()
3846
{
3947
ObjectMapper mapper = new ObjectMapper();

jaxb/src/test/java/com/fasterxml/jackson/module/jaxb/introspect/TestAccessType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ public void testForJackson288() throws Exception
106106

107107
public void testInclusionIssue40() throws Exception
108108
{
109-
ObjectMapper mapper = getJaxbMapper();
110-
mapper.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);
109+
ObjectMapper mapper = getJaxbMapperBuilder()
110+
.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)
111+
.build();
111112
String json = mapper.writeValueAsString(new Bean40());
112113
@SuppressWarnings("unchecked")
113114
Map<String,Object> map = mapper.readValue(json, Map.class);

jaxb/src/test/java/com/fasterxml/jackson/module/jaxb/introspect/TestJaxbAnnotationIntrospector.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,10 @@ public void testDetection() throws Exception
233233
*/
234234
public void testSerializeDeserializeWithJaxbAnnotations() throws Exception
235235
{
236-
ObjectMapper mapper = getJaxbMapper();
237-
// test expects that wrapper name be used...
238-
mapper.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);
236+
ObjectMapper mapper = getJaxbMapperBuilder()
237+
// test expects that wrapper name be used...
238+
.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)
239+
.build();
239240

240241
mapper.enable(SerializationFeature.INDENT_OUTPUT);
241242
JaxbExample ex = new JaxbExample();

jaxb/src/test/java/com/fasterxml/jackson/module/jaxb/introspect/TestJaxbAutoDetect.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ public void testAutoDetectDisable() throws IOException
113113
assertEquals("b", result.get("b"));
114114

115115
// But when disabling auto-detection, just one
116-
mapper = getJaxbMapper();
117-
mapper.configure(MapperFeature.AUTO_DETECT_GETTERS, false);
116+
mapper = getJaxbMapperBuilder()
117+
.configure(MapperFeature.AUTO_DETECT_GETTERS, false)
118+
.build();
118119
result = writeAndMap(mapper, bean);
119120
assertEquals(1, result.size());
120121
assertNull(result.get("a"));

jaxb/src/test/java/com/fasterxml/jackson/module/jaxb/misc/TestElementWrapper.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ public Bean25(int... v0) {
7777
// [JACKSON-436]
7878
public void testWrapperWithCollection() throws Exception
7979
{
80-
ObjectMapper mapper = getJaxbMapper();
81-
// for fun, force renaming with wrapper annotation, even for JSON
82-
mapper.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);
80+
ObjectMapper mapper = getJaxbMapperBuilder()
81+
// for fun, force renaming with wrapper annotation, even for JSON
82+
.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)
83+
.build();
8384
Collection<IPhone> phones = new HashSet<IPhone>();
8485
phones.add(new Phone("555-6666"));
8586
Person p = new Person();
@@ -108,17 +109,19 @@ public void testWrapperRenaming() throws Exception
108109
input.id = 3;
109110
assertEquals("{\"id\":3}", mapper.writeValueAsString(input));
110111
// but if we create new instance, configure
111-
mapper = getJaxbMapper();
112-
mapper.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);
112+
mapper = getJaxbMapperBuilder()
113+
.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)
114+
.build();
113115
assertEquals("{\"wrap\":3}", mapper.writeValueAsString(input));
114116
}
115117

116118
// [Issue#25]
117119
public void testWrapperDefaultName() throws Exception
118120
{
119121
ObjectMapper mapper = getJaxbMapper();
120-
mapper = getJaxbMapper();
121-
mapper.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);
122+
mapper = getJaxbMapperBuilder()
123+
.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)
124+
.build();
122125
Bean25 input = new Bean25(1, 2, 3);
123126
final String JSON = "{\"values\":[1,2,3]}";
124127
assertEquals(JSON, mapper.writeValueAsString(input));

0 commit comments

Comments
 (0)