Skip to content

Commit 487ecf8

Browse files
author
xinying7
committed
fix flaky test serializeArrayModel
1 parent 13d816f commit 487ecf8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import io.swagger.v3.oas.models.media.Schema;
1818
import io.swagger.v3.oas.models.media.StringSchema;
1919
import org.testng.annotations.Test;
20+
import org.json.JSONObject;
21+
import org.skyscreamer.jsonassert.JSONAssert;
2022

2123
import java.io.IOException;
2224
import java.math.BigDecimal;
@@ -110,7 +112,11 @@ public void deserializeModel() throws IOException {
110112
public void serializeArrayModel() throws IOException {
111113
final ArraySchema model = new ArraySchema();
112114
model.setItems(new Schema().$ref("Pet"));
113-
assertEquals(m.writeValueAsString(model), "{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/Pet\"}}");
115+
String json1 = m.writeValueAsString(model);
116+
String json2 = "{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/Pet\"}}";
117+
JSONObject jsonObj1 = new JSONObject(json1);
118+
JSONObject jsonObj2 = new JSONObject(json2);
119+
JSONAssert.assertEquals(jsonObj1, jsonObj2, true);
114120
}
115121

116122
@Test(description = "it should deserialize an array model")

0 commit comments

Comments
 (0)