Skip to content

Commit b48706f

Browse files
author
xinying7
committed
fix flaky test deserializeDateTimeProperty
1 parent b0df0d6 commit b48706f

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/properties/PropertySerializationTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ public void serializeDateTimeProperty() throws IOException {
7777

7878
@Test(description = "it should deserialize a DateTimeProperty")
7979
public void deserializeDateTimeProperty() throws IOException {
80-
final String json = "{\"type\":\"string\",\"format\":\"date-time\"}";
81-
final Schema p = m.readValue(json, Schema.class);
80+
final String json1 = "{\"type\":\"string\",\"format\":\"date-time\"}";
81+
final Schema p = m.readValue(json1, Schema.class);
8282
assertEquals(p.getType(), "string");
8383
assertEquals(p.getFormat(), "date-time");
8484
assertEquals(p.getClass(), DateTimeSchema.class);
85-
assertEquals(m.writeValueAsString(p), json);
85+
String json2 = m.writeValueAsString(p);
86+
JSONObject jsonObj1 = new JSONObject(json1);
87+
JSONObject jsonObj2 = new JSONObject(json2);
88+
JSONAssert.assertEquals(jsonObj1, jsonObj2, true);
8689
}
8790

8891
@Test(description = "it should serialize a DoubleProperty")

0 commit comments

Comments
 (0)