Skip to content

Commit 8a4a91b

Browse files
author
xinying7
committed
fixing flaky test serializeDoubleProperty
1 parent f53ab4f commit 8a4a91b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import io.swagger.v3.oas.models.media.Schema;
1414
import io.swagger.v3.oas.models.media.StringSchema;
1515
import org.testng.annotations.Test;
16+
import org.json.JSONObject;
17+
import org.skyscreamer.jsonassert.JSONAssert;
1618

1719
import java.io.IOException;
1820
import java.math.BigDecimal;
@@ -85,8 +87,12 @@ public void serializeDoubleProperty() throws IOException {
8587
final NumberSchema p = new NumberSchema()
8688
._default(new BigDecimal("3.14159"));
8789
p.format("double");
88-
final String json = "{\"type\":\"number\",\"format\":\"double\",\"default\":3.14159}";
89-
assertEquals(m.writeValueAsString(p), json);
90+
final String json1 = "{\"type\":\"number\",\"format\":\"double\",\"default\":3.14159}";
91+
String json2 = m.writeValueAsString(p);
92+
JSONObject jsonObj1 = new JSONObject(json1);
93+
JSONObject jsonObj2 = new JSONObject(json2);
94+
95+
JSONAssert.assertEquals(jsonObj1, jsonObj2, true);
9096
}
9197

9298
@Test(description = "it should deserialize a DoubleProperty")

0 commit comments

Comments
 (0)