fix(#887): complete strictMode for JSONArray

This commit is contained in:
rikkarth
2024-04-14 23:11:17 +01:00
parent d02ac0f2a3
commit fe597d296e
2 changed files with 55 additions and 0 deletions

View File

@@ -46,6 +46,16 @@ public class JSONParserConfigurationTest {
() -> new JSONArray(testCase, jsonParserConfiguration)));
}
@Test
public void givenValidDoubleArray_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[[\"c\"],[\"a\"]]";
new JSONArray(testCase, jsonParserConfiguration);
}
@Test
public void givenCompliantJSONArrayFile_testStrictModeTrue_shouldNotThrowAnyException() throws IOException {
try (Stream<String> lines = Files.lines(Paths.get("src/test/resources/compliantJsonArray.json"))) {
@@ -208,6 +218,15 @@ public class JSONParserConfigurationTest {
*/
private List<String> getNonCompliantJSONList() {
return Arrays.asList(
"[]asdf",
"[]]",
"[]}",
"[][",
"[]{",
"[],",
"[]:",
"[],[",
"[],{",
"[1,2];[3,4]",
"[test]",
"[{'testSingleQuote': 'testSingleQuote'}]",