Make JSON assertions more strict

This commit is contained in:
Stephane Nicoll
2022-04-11 16:36:04 +02:00
parent f65136dd68
commit 10dc10dbf9
6 changed files with 19 additions and 9 deletions
@@ -144,7 +144,7 @@ public class FileNativeConfigurationWriterTests {
],
"queriedMethods": [
{ "name": "<init>", "parameterTypes": [ "java.util.List", "boolean", "org.springframework.util.MimeType" ] },
{ "name": "getDefaultCharset" }
{ "name": "getDefaultCharset", "parameterTypes": [ ] }
]
}
]""", "reflect-config.json");
@@ -186,7 +186,7 @@ public class FileNativeConfigurationWriterTests {
private void assertEquals(String expectedString, String filename) throws IOException, JSONException {
Path jsonFile = tempDir.resolve("META-INF").resolve("native-image").resolve(filename);
String content = new String(Files.readAllBytes(jsonFile));
JSONAssert.assertEquals(expectedString, content, JSONCompareMode.LENIENT);
JSONAssert.assertEquals(expectedString, content, JSONCompareMode.NON_EXTENSIBLE);
}
}
@@ -65,7 +65,7 @@ public class JavaSerializationHintsWriterTests {
StringWriter out = new StringWriter();
BasicJsonWriter writer = new BasicJsonWriter(out, "\t");
JavaSerializationHintsWriter.INSTANCE.write(writer, hints);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.LENIENT);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE);
}
}
@@ -66,7 +66,7 @@ public class ProxyHintsWriterTests {
StringWriter out = new StringWriter();
BasicJsonWriter writer = new BasicJsonWriter(out, "\t");
ProxyHintsWriter.INSTANCE.write(writer, hints);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.LENIENT);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE);
}
}
@@ -95,7 +95,7 @@ public class ReflectionHintsWriterTests {
],
"queriedMethods": [
{ "name": "<init>", "parameterTypes": [ "java.util.List", "boolean", "org.springframework.util.MimeType" ] },
{ "name": "getDefaultCharset" }
{ "name": "getDefaultCharset", "parameterTypes": [ ] }
]
}
]""", hints);
@@ -191,7 +191,7 @@ public class ReflectionHintsWriterTests {
StringWriter out = new StringWriter();
BasicJsonWriter writer = new BasicJsonWriter(out, "\t");
ReflectionHintsWriter.INSTANCE.write(writer, hints);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.LENIENT);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE);
}
}
@@ -120,7 +120,7 @@ public class ResourceHintsWriterTests {
StringWriter out = new StringWriter();
BasicJsonWriter writer = new BasicJsonWriter(out, "\t");
ResourceHintsWriter.INSTANCE.write(writer, hints);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.LENIENT);
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE);
}
}