Skip to content

Commit d5d82cd

Browse files
committed
fixing sonarcube issues
1 parent 0a9364e commit d5d82cd

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

src/test/java/org/json/junit/JSONObjectTest.java

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4000,19 +4000,24 @@ public void testStrictModeJSONTokener_expectException(){
40004000
@Test
40014001
public void test_strictModeWithMisCasedBooleanOrNullValue(){
40024002
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration().withStrictMode();
4003-
40044003
try{
4005-
JSONObject j1 = new JSONObject("{\"a\":True}", jsonParserConfiguration);
4004+
new JSONObject("{\"a\":True}", jsonParserConfiguration);
40064005
fail("Expected an exception");
4007-
} catch (JSONException e) { }
4006+
} catch (JSONException e) {
4007+
// No action, expected outcome
4008+
}
40084009
try{
4009-
JSONObject j2 = new JSONObject("{\"a\":TRUE}", jsonParserConfiguration);
4010+
new JSONObject("{\"a\":TRUE}", jsonParserConfiguration);
40104011
fail("Expected an exception");
4011-
} catch (JSONException e) { }
4012+
} catch (JSONException e) {
4013+
// No action, expected outcome
4014+
}
40124015
try{
4013-
JSONObject j2 = new JSONObject("{\"a\":nUlL}", jsonParserConfiguration);
4016+
new JSONObject("{\"a\":nUlL}", jsonParserConfiguration);
40144017
fail("Expected an exception");
4015-
} catch (JSONException e) { }
4018+
} catch (JSONException e) {
4019+
// No action, expected outcome
4020+
}
40164021
}
40174022

40184023
@Test
@@ -4021,17 +4026,23 @@ public void test_strictModeWithInappropriateKey(){
40214026

40224027
// Parsing the following objects should fail
40234028
try{
4024-
JSONObject j3 = new JSONObject("{true : 3}", jsonParserConfiguration);
4029+
new JSONObject("{true : 3}", jsonParserConfiguration);
40254030
fail("Expected an exception");
4026-
} catch (JSONException e) { }
4031+
} catch (JSONException e) {
4032+
// No action, expected outcome
4033+
}
40274034
try{
4028-
JSONObject j4 = new JSONObject("{TRUE : 3}", jsonParserConfiguration);
4035+
new JSONObject("{TRUE : 3}", jsonParserConfiguration);
40294036
fail("Expected an exception");
4030-
} catch (JSONException e) { }
4037+
} catch (JSONException e) {
4038+
// No action, expected outcome
4039+
}
40314040
try{
4032-
JSONObject j5 = new JSONObject("{1 : 3}", jsonParserConfiguration);
4041+
new JSONObject("{1 : 3}", jsonParserConfiguration);
40334042
fail("Expected an exception");
4034-
} catch (JSONException e) { }
4043+
} catch (JSONException e) {
4044+
// No action, expected outcome
4045+
}
40354046

40364047
}
40374048

0 commit comments

Comments
 (0)