Skip to content

Commit

Permalink
streams - cleanup unneeded test cases, refactor to remove warnings in…
Browse files Browse the repository at this point in the history
… ParserConfiguration
  • Loading branch information
Sean Leary authored and Sean Leary committed Sep 16, 2023
1 parent 4d0bb3a commit 6e670d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/json/ParserConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/**
* Configuration base object for parsers. The configuration is immutable.
*/
@SuppressWarnings({""})
public class ParserConfiguration {
/**
* Used to indicate there's no defined limit to the maximum nesting depth when parsing a document.
Expand Down Expand Up @@ -68,10 +67,9 @@ public boolean isKeepStrings() {
/**
* When parsing the XML into JSONML, specifies if values should be kept as strings (<code>true</code>), or if
* they should try to be guessed into JSON values (numeric, boolean, string)
*
* @param <T> type parameter
* @param newVal
* new value to use for the <code>keepStrings</code> configuration option.
*
* @return The existing configuration will not be modified. A new configuration is returned.
*/
public <T extends ParserConfiguration> T withKeepStrings(final boolean newVal) {
Expand All @@ -95,6 +93,7 @@ public int getMaxNestingDepth() {
* will throw a JsonException if the maximum depth is reached.
* Using any negative value as a parameter is equivalent to setting no limit to the nesting depth,
* which means the parses will go as deep as the maximum call stack size allows.
* @param <T> type parameter
* @param maxNestingDepth the maximum nesting depth allowed to the XML parser
* @return The existing configuration will not be modified. A new configuration is returned.
*/
Expand Down
35 changes: 0 additions & 35 deletions src/test/java/org/json/junit/JSONObjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,41 +314,6 @@ public void test_2_4_1() {
assertEquals(jsonObject.toString(), newJsonObject.toString());
}

/**
* Confirms new iterator() functionality
*/
@Test
public void testIterator() {
JSONObject jsonObject = new JSONObject("{ a: 1, b: true, c: \"abc\" }");
Iterator<String> it1 = jsonObject.keys();
Iterator<String> it2 = jsonObject.iterator();
boolean isEqual = true;
while (it1.hasNext() && it2.hasNext()) {
if (!it1.next().equals(it2.next())) {
isEqual = false;
break;
}
}
isEqual = isEqual && !it1.hasNext() && !it2.hasNext();
assertTrue("Iterators are not equal", isEqual);
}

/**
* Test Case 3.2.1: Test the behavior of the stream() method when applied to an empty JSONObject
*/
@Test
public void test_3_2_1() {
JSONObject jsonObject = new JSONObject();

List<Map.Entry<String, Object>> entriesList = jsonObject.stream()
.collect(Collectors.toList());

System.out.println(entriesList);

assertTrue(entriesList.isEmpty());
}


/**
* Tests that the similar method is working as expected.
*/
Expand Down

0 comments on commit 6e670d5

Please sign in to comment.