test(#871-strictMode): strict mode false initial implementation

This commit is contained in:
rikkarth 2024-03-15 01:23:20 +00:00
parent 63e8314deb
commit c140e91bb8

View File

@ -31,7 +31,7 @@ public class JSONParserConfigurationTest {
@Test
public void givenInvalidInputArrays_testStrictModeTrue_shouldThrowJsonException() {
List<String> strictModeInputTestCases = Arrays.asList("[1,2];[3,4]", "", "[1, 2,3]:[4,5]"/*, "[{test: implied}]"*/);
List<String> strictModeInputTestCases = Arrays.asList("[1,2];[3,4]", "", "[1, 2,3]:[4,5]", "[{test: implied}]");
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
@ -43,6 +43,15 @@ public class JSONParserConfigurationTest {
});
}
@Test
public void givenInvalidInputArrays_testStrictModeFalse_shouldNotThrowAnyException() {
List<String> strictModeInputTestCases = Arrays.asList("[1,2];[3,4]", "[1, 2,3]:[4,5]", "[{test: implied}]");
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
strictModeInputTestCases.stream().peek(System.out::println).forEach(testCase -> new JSONArray(testCase, jsonParserConfiguration));
}
@Test
public void verifyDuplicateKeyThenMaxDepth() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()