Skip to content

Commit c5a81b3

Browse files
committed
Merge branch '2.14'
2 parents 5a1a891 + aa17472 commit c5a81b3

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

jaxb/src/test/java/com/fasterxml/jackson/module/jaxb/id/TestXmlID2.java

+12-5
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ private List<User> getUserList()
116116

117117
public void testIdWithJacksonRules() throws Exception
118118
{
119-
String expected = "[{\"id\":11,\"username\":\"11\",\"email\":\"[email protected]\","
120-
+"\"department\":{\"id\":9,\"name\":\"department9\",\"employees\":["
121-
+"11,{\"id\":22,\"username\":\"22\",\"email\":\"[email protected]\","
122-
+"\"department\":9}]}},22,{\"id\":33,\"username\":\"33\",\"email\":\"[email protected]\",\"department\":null}]";
123119
ObjectMapper mapper = JsonMapper.builder()
124120
// true -> ignore XmlIDREF annotation
125121
.annotationIntrospector(new JaxbAnnotationIntrospector(true))
@@ -128,13 +124,24 @@ public void testIdWithJacksonRules() throws Exception
128124
// first, with default settings (first NOT as id)
129125
List<User> users = getUserList();
130126
String json = mapper.writeValueAsString(users);
131-
assertEquals(expected, json);
132127

133128
List<User> result = mapper.readValue(json, new TypeReference<List<User>>() { });
134129
assertEquals(3, result.size());
135130
assertEquals(Long.valueOf(11), result.get(0).id);
131+
assertEquals("11", result.get(0).username);
132+
assertEquals("[email protected]", result.get(0).email);
133+
assertEquals(Long.valueOf(9), result.get(0).department.id);
134+
assertEquals("department9", result.get(0).department.name);
135+
assertEquals(Long.valueOf(11), result.get(0).department.employees.get(0).id);
136+
assertEquals(Long.valueOf(22), result.get(0).department.employees.get(1).id);
136137
assertEquals(Long.valueOf(22), result.get(1).id);
138+
assertEquals("22", result.get(1).username);
139+
assertEquals("[email protected]", result.get(1).email);
140+
assertEquals(result.get(0).department, result.get(1).department);
137141
assertEquals(Long.valueOf(33), result.get(2).id);
142+
assertEquals("33", result.get(2).username);
143+
assertEquals("[email protected]", result.get(2).email);
144+
assertEquals(null, result.get(2).department);
138145
}
139146

140147
public void testIdWithJaxbRules() throws Exception

0 commit comments

Comments
 (0)