-
-
Notifications
You must be signed in to change notification settings - Fork 220
/
DefaultTyping325Test.java
36 lines (28 loc) · 1.17 KB
/
DefaultTyping325Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.fasterxml.jackson.dataformat.xml.failing;
import java.io.IOException;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
import com.fasterxml.jackson.dataformat.xml.testutil.NoCheckSubTypeValidator;
public class DefaultTyping325Test extends XmlTestBase
{
static class Simple325 {
protected String[] list;
public String[] getList( ) { return list; }
public void setList(String[] l) { list = l; }
}
// [dataformat-xml#325]
public void testDefaultTypingWithInnerClass() throws IOException
{
ObjectMapper mapper = mapperBuilder()
.activateDefaultTyping(NoCheckSubTypeValidator.instance,
ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.WRAPPER_OBJECT)
.build();
Simple325 s = new Simple325();
s.setList(new String[] { "foo", "bar" });
String doc = mapper.writeValueAsString(s);
Simple325 result = mapper.readValue(doc, Simple325.class);
assertNotNull(result.list);
assertEquals(2, result.list.length);
}
}