Skip to content

Commit 5c14b5e

Browse files
authored
Merge pull request #154 from HildoYe/fix-flaky
Fixed flaky test testIdWithJacksonRules
2 parents 036cfb9 + fa3fe76 commit 5c14b5e

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ private List<User> getUserList()
115115

116116
public void testIdWithJacksonRules() throws Exception
117117
{
118-
String expected = "[{\"id\":11,\"username\":\"11\",\"email\":\"[email protected]\","
119-
+"\"department\":{\"id\":9,\"name\":\"department9\",\"employees\":["
120-
+"11,{\"id\":22,\"username\":\"22\",\"email\":\"[email protected]\","
121-
+"\"department\":9}]}},22,{\"id\":33,\"username\":\"33\",\"email\":\"[email protected]\",\"department\":null}]";
122118
ObjectMapper mapper = JsonMapper.builder()
123119
// true -> ignore XmlIDREF annotation
124120
.annotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance(),
@@ -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)