diff --git a/README.md b/README.md
index faf400a..0772d3b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
Unit tests to validate the JSON-Java GitHub project code
-https://github.com/douglascrockford/JSON-java
+https://github.com/stleary/JSON-java
Gradle and Eclipse is the recommended build tool and IDE.
Run individual tests or JunitTestSuite using EclEmma Coverage, or execute the **TestRunner** application directly.
diff --git a/src/test/java/org/json/junit/EnumTest.java b/src/test/java/org/json/junit/EnumTest.java
index ab4a1e5..6b97107 100644
--- a/src/test/java/org/json/junit/EnumTest.java
+++ b/src/test/java/org/json/junit/EnumTest.java
@@ -5,7 +5,6 @@
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -92,7 +91,7 @@ public void jsonObjectFromEnumWithNames() {
assertTrue("expected 3 top level items", ((Map,?>)(JsonPath.read(doc, "$"))).size() == 3);
assertTrue("expected VAL1", MyEnumField.VAL1.equals(jsonObject.query("/VAL1")));
assertTrue("expected VAL2", MyEnumField.VAL2.equals(jsonObject.query("/VAL2")));
- assertTrue("expected VAL3", myEnumField.VAL3.equals(jsonObject.query("/VAL3")));
+ assertTrue("expected VAL3", MyEnumField.VAL3.equals(jsonObject.query("/VAL3")));
}
/**
diff --git a/src/test/java/org/json/junit/JSONArrayTest.java b/src/test/java/org/json/junit/JSONArrayTest.java
index 244a693..80b78a5 100644
--- a/src/test/java/org/json/junit/JSONArrayTest.java
+++ b/src/test/java/org/json/junit/JSONArrayTest.java
@@ -1,11 +1,11 @@
package org.json.junit;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
+import java.io.IOException;
import java.io.StringWriter;
-import java.io.Writer;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
@@ -61,7 +61,7 @@ public class JSONArrayTest {
@Test(expected=NullPointerException.class)
public void nullException() {
String str = null;
- new JSONArray(str);
+ assertNull("Should throw an exception", new JSONArray(str));
}
/**
@@ -72,8 +72,7 @@ public void nullException() {
public void emptStr() {
String str = "";
try {
- new JSONArray(str);
- assertTrue("Should throw an exception", false);
+ assertNull("Should throw an exception", new JSONArray(str));
} catch (JSONException e) {
assertTrue("Expected an exception message",
"A JSONArray text must start with '[' at 1 [character 2 line 1]".
@@ -90,8 +89,7 @@ public void emptStr() {
public void badObject() {
String str = "abc";
try {
- new JSONArray((Object)str);
- assertTrue("Should throw an exception", false);
+ assertNull("Should throw an exception", new JSONArray((Object)str));
} catch (JSONException e) {
assertTrue("Expected an exception message",
"JSONArray initial value should be a string or collection or array.".
@@ -100,7 +98,7 @@ public void badObject() {
}
/**
- * Verifies that the constructor has backwards compatability with RAW types pre-java5.
+ * Verifies that the constructor has backwards compatibility with RAW types pre-java5.
*/
@Test
public void verifyConstructor() {
@@ -130,7 +128,7 @@ public void verifyConstructor() {
}
/**
- * Verifies that the put Collection has backwards compatability with RAW types pre-java5.
+ * Verifies that the put Collection has backwards compatibility with RAW types pre-java5.
*/
@Test
public void verifyPutCollection() {
@@ -164,7 +162,7 @@ public void verifyPutCollection() {
/**
- * Verifies that the put Map has backwards compatability with RAW types pre-java5.
+ * Verifies that the put Map has backwards compatibility with RAW types pre-java5.
*/
@Test
public void verifyPutMap() {
@@ -209,9 +207,10 @@ public void verifyPutMap() {
* Create a JSONArray doc with a variety of different elements.
* Confirm that the values can be accessed via the get[type]() API methods
*/
+ @SuppressWarnings("boxing")
@Test
public void getArrayValues() {
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(this.arrayStr);
// booleans
assertTrue("Array true",
true == jsonArray.getBoolean(0));
@@ -255,7 +254,7 @@ public void getArrayValues() {
*/
@Test
public void failedGetArrayValues() {
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(this.arrayStr);
try {
jsonArray.getBoolean(4);
assertTrue("expected getBoolean to fail", false);
@@ -321,7 +320,7 @@ public void failedGetArrayValues() {
*/
@Test
public void join() {
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(this.arrayStr);
String joinStr = jsonArray.join(",");
// validate JSON
@@ -357,7 +356,7 @@ public void join() {
public void length() {
assertTrue("expected empty JSONArray length 0",
new JSONArray().length() == 0);
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(this.arrayStr);
assertTrue("expected JSONArray length 13", jsonArray.length() == 13);
JSONArray nestedJsonArray = jsonArray.getJSONArray(9);
assertTrue("expected JSONArray length 1", nestedJsonArray.length() == 1);
@@ -368,9 +367,10 @@ public void length() {
* Confirm that the values can be accessed via the opt[type](index)
* and opt[type](index, default) API methods.
*/
+ @SuppressWarnings("boxing")
@Test
public void opt() {
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(this.arrayStr);
assertTrue("Array opt value true",
Boolean.TRUE == jsonArray.opt(0));
assertTrue("Array opt value out of range",
@@ -441,6 +441,7 @@ public void optStringConversion(){
* Exercise the JSONArray.put(value) method with various parameters
* and confirm the resulting JSONArray.
*/
+ @SuppressWarnings("boxing")
@Test
public void put() {
JSONArray jsonArray = new JSONArray();
@@ -516,6 +517,7 @@ public void put() {
* Exercise the JSONArray.put(index, value) method with various parameters
* and confirm the resulting JSONArray.
*/
+ @SuppressWarnings("boxing")
@Test
public void putIndex() {
JSONArray jsonArray = new JSONArray();
@@ -596,11 +598,11 @@ public void putIndex() {
*/
@Test
public void remove() {
- String arrayStr =
+ String arrayStr1 =
"["+
"1"+
"]";
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(arrayStr1);
jsonArray.remove(0);
assertTrue("array should be empty", null == jsonArray.remove(5));
assertTrue("jsonArray should be empty", jsonArray.length() == 0);
@@ -612,11 +614,11 @@ public void remove() {
*/
@Test
public void notSimilar() {
- String arrayStr =
+ String arrayStr1 =
"["+
"1"+
"]";
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(arrayStr1);
JSONArray otherJsonArray = new JSONArray();
assertTrue("arrays lengths differ", !jsonArray.similar(otherJsonArray));
@@ -745,9 +747,10 @@ public void objectArrayVsIsArray() {
/**
* Exercise the JSONArray iterator.
*/
+ @SuppressWarnings("boxing")
@Test
public void iterator() {
- JSONArray jsonArray = new JSONArray(arrayStr);
+ JSONArray jsonArray = new JSONArray(this.arrayStr);
Iterator