Skip to content

Commit c869440

Browse files
author
xinying7
committed
fix flaky test testExtensionObjectWithProperties
1 parent 7b31c48 commit c869440

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/JsonSerializationTest.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.servers.Server;
1818
import org.testng.annotations.Test;
1919
import org.yaml.snakeyaml.LoaderOptions;
20+
import org.json.JSONObject;
21+
import org.skyscreamer.jsonassert.JSONAssert;
2022

2123
import java.util.HashMap;
2224
import java.util.Map;
@@ -68,7 +70,11 @@ public void testExtensionObjectWithProperties() throws Exception {
6870
swagger.addExtension("x-extension-with-properties", extensionObjectProps);
6971

7072
String swaggerJson = Json.mapper().writeValueAsString(swagger);
71-
assertEquals(swaggerJson, "{\"openapi\":\"3.0.1\",\"x-extension-with-properties\":{\"x-foo-bar\":\"foo bar\",\"x-bar-foo\":null}}");
73+
String json2 = "{\"openapi\":\"3.0.1\",\"x-extension-with-properties\":{\"x-foo-bar\":\"foo bar\",\"x-bar-foo\":null}}";
74+
JSONObject jsonObj1 = new JSONObject(swaggerJson);
75+
JSONObject jsonObj2 = new JSONObject(json2);
76+
77+
JSONAssert.assertEquals(jsonObj1, jsonObj2, true);
7278
}
7379

7480
@Test

0 commit comments

Comments
 (0)