Skip to content

Commit 950b900

Browse files
author
xinying7
committed
fix flaky test deserializeArrayModel
1 parent 487ecf8 commit 950b900

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/ModelSerializerTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,13 @@ public void serializeArrayModel() throws IOException {
121121

122122
@Test(description = "it should deserialize an array model")
123123
public void deserializeArrayModel() throws IOException {
124-
final String json = "{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/Pet\"}}";
125-
final Schema p = m.readValue(json, Schema.class);
124+
final String json1 = "{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/Pet\"}}";
125+
final Schema p = m.readValue(json1, Schema.class);
126+
String json2 = m.writeValueAsString(p);
127+
JSONObject jsonObj1 = new JSONObject(json1);
128+
JSONObject jsonObj2 = new JSONObject(json2);
126129
assertTrue(p instanceof ArraySchema);
127-
assertEquals(m.writeValueAsString(p), json);
130+
JSONAssert.assertEquals(jsonObj1, jsonObj2, true);
128131
}
129132

130133
@Test(description = "it should not create an xml object for $ref")

0 commit comments

Comments
 (0)