Skip to content

Commit

Permalink
test(stleary#871-strictMode): strict mode false initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rikkarth committed Mar 15, 2024
1 parent 63e8314 commit c140e91
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/test/java/org/json/junit/JSONParserConfigurationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void testOverwrite() {

@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);

Expand All @@ -43,6 +43,15 @@ public void givenInvalidInputArrays_testStrictModeTrue_shouldThrowJsonException(
});
}

@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()
Expand Down

0 comments on commit c140e91

Please sign in to comment.