Commits

John Marsden committed e0109b8

Update code for the addition of InputStream Reading. Rename tests from 'Standard' to 'Strict'.

  • Participants
  • Parent commits 3331dbd

Comments (0)

Files changed (14)

File src/main/java/cc/plural/json/JSONParseStringInputOutput.java

-/**
- * Copyright (C) 2010-2011 J.W.Marsden
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-package cc.plural.json;
-
-/**
- *
- * @author jmarsden
- */
-public interface JSONParseStringInputOutput extends TimedLibrary {
-    
-    public String parseJSONString(String jsonDocument) throws JSONParseStringInputException;
-    
-    public long getParseTime();
-    
-    public long getToJSONStringTime();
-}

File src/main/java/cc/plural/json/JSONParsingTest.java

-/**
- * Copyright (C) 2010-2011 J.W.Marsden
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-package cc.plural.json;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import jsonij.json.JSON;
-import jsonij.parser.ParserException;
-
-/**
- *
- * @author jmarsden
- */
-public abstract class JSONParsingTest extends JSONTest {
-
-    protected String expectedOutput;
-    protected boolean expectedOutputError;
-
-    public JSONParsingTest() {
-        input = null;
-        expectedOutput = null;
-        expectedOutputError = false;
-    }
-
-    @Override
-    public JSONParsingTestResult createRestResult() {
-        return new JSONParsingTestResult(this);
-    }
-
-    public void evaluate(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONTestException {
-        
-        JSONParseStringInputOutput jsonPackageParseStringInputOutput = null;
-        JSONParsingTestResult jsonParsingTestResult = null;
-        
-        if(jsonPackage instanceof JSONParseStringInputOutput) {
-            jsonPackageParseStringInputOutput = (JSONParseStringInputOutput) jsonPackage;
-        }
-        if(jsonResult instanceof JSONParsingTestResult) {
-            jsonParsingTestResult = (JSONParsingTestResult) jsonResult;
-        }
-        
-        try {
-            output = evaluatePayload(jsonPackage, jsonResult);
-            jsonResult.setOutput(output);
-        } catch (JSONTestException ex) {
-            if (expectedOutputError) {
-                jsonResult.exception = ex;
-                jsonResult.output = ex.getCause().toString();
-            } else {
-                throw ex;
-            }
-        } finally {
-            jsonResult.description = description;
-            jsonResult.input = input;
-        }
-        
-        if(!expectedOutputError) { 
-            long timeSum = 0;
-            long parseTimeSum = 0;
-            long toJSONTimeSum = 0;
-            int loopCount = 10000;
-            for (int i = 0; i < loopCount; i++) {
-                evaluatePayload(jsonPackage, jsonResult);
-                timeSum += jsonPackage.getTotalTimeNano();
-                if(jsonPackageParseStringInputOutput != null) { 
-                    parseTimeSum += jsonPackageParseStringInputOutput.getParseTime();
-                    toJSONTimeSum += jsonPackageParseStringInputOutput.getToJSONStringTime();
-                }
-            }
-            jsonResult.executionTimeAverage = new BigDecimal(timeSum).divide(new BigDecimal((double) loopCount)).longValue();
-            if(jsonParsingTestResult != null) {
-                jsonParsingTestResult.parseTimeAverage = new BigDecimal(parseTimeSum).divide(new BigDecimal((double) loopCount)).longValue();
-                jsonParsingTestResult.toJSONTimeAverage = new BigDecimal(toJSONTimeSum).divide(new BigDecimal((double) loopCount)).longValue();
-            }
-        }
-    }
-
-    public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONTestException {
-        return jsonPackage.parseJSONString(input);
-    }
-
-    @Override
-    public boolean testPassed(JSONTestResult jsonResult) {
-        boolean result = false;
-        if (expectedOutputError == true) {
-            result = jsonResult.exception != null;
-        } else {
-            if(jsonResult.output == null) {
-                return false;
-            }
-            try {
-                final JSON expectedJSON = JSON.parse(expectedOutput);
-                final JSON outputJSON = JSON.parse(jsonResult.output);
-                result = expectedJSON.getRoot().equals(outputJSON.getRoot());
-            } catch (ParserException ex) {
-            } catch (IOException ex) {
-            }
-        }
-        return result;
-    }
-}

File src/main/java/cc/plural/json/JSONStringParsingTest.java

+/**
+ * Copyright (C) 2010-2011 J.W.Marsden
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ **/
+package cc.plural.json;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import jsonij.json.JSON;
+import jsonij.parser.ParserException;
+
+/**
+ *
+ * @author jmarsden
+ */
+public abstract class JSONStringParsingTest extends JSONTest {
+
+    protected String expectedOutput;
+    protected boolean expectedOutputError;
+
+    public JSONStringParsingTest() {
+        input = null;
+        expectedOutput = null;
+        expectedOutputError = false;
+    }
+
+    @Override
+    public JSONParsingTestResult createRestResult() {
+        return new JSONParsingTestResult(this);
+    }
+
+    public void evaluate(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONTestException {
+        
+        JSONParseStringInputStringOutput jsonPackageParseStringInputOutput = null;
+        JSONParsingTestResult jsonParsingTestResult = null;
+        
+        if(jsonPackage instanceof JSONParseStringInputStringOutput) {
+            jsonPackageParseStringInputOutput = (JSONParseStringInputStringOutput) jsonPackage;
+        }
+        if(jsonResult instanceof JSONParsingTestResult) {
+            jsonParsingTestResult = (JSONParsingTestResult) jsonResult;
+        }
+        
+        try {
+            output = evaluatePayload(jsonPackage, jsonResult);
+            jsonResult.setOutput(output);
+        } catch (JSONTestException ex) {
+            if (expectedOutputError) {
+                jsonResult.exception = ex;
+                jsonResult.output = ex.getCause().toString();
+            } else {
+                throw ex;
+            }
+        } finally {
+            jsonResult.description = description;
+            jsonResult.input = input;
+        }
+        
+        if(!expectedOutputError) { 
+            long timeSum = 0;
+            long parseTimeSum = 0;
+            long toJSONTimeSum = 0;
+            int loopCount = 10000;
+            for (int i = 0; i < loopCount; i++) {
+                evaluatePayload(jsonPackage, jsonResult);
+                timeSum += jsonPackage.getTotalTimeNano();
+                if(jsonPackageParseStringInputOutput != null) { 
+                    parseTimeSum += jsonPackageParseStringInputOutput.getParseTime();
+                    toJSONTimeSum += jsonPackageParseStringInputOutput.getToJSONStringTime();
+                }
+            }
+            jsonResult.executionTimeAverage = new BigDecimal(timeSum).divide(new BigDecimal((double) loopCount)).longValue();
+            if(jsonParsingTestResult != null) {
+                jsonParsingTestResult.parseTimeAverage = new BigDecimal(parseTimeSum).divide(new BigDecimal((double) loopCount)).longValue();
+                jsonParsingTestResult.toJSONTimeAverage = new BigDecimal(toJSONTimeSum).divide(new BigDecimal((double) loopCount)).longValue();
+            }
+        }
+    }
+
+    public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONTestException {
+        return jsonPackage.parseJSONString(input);
+    }
+
+    @Override
+    public boolean testPassed(JSONTestResult jsonResult) {
+        boolean result = false;
+        if (expectedOutputError == true) {
+            result = jsonResult.exception != null;
+        } else {
+            if(jsonResult.output == null) {
+                return false;
+            }
+            try {
+                final JSON expectedJSON = JSON.parse(expectedOutput);
+                final JSON outputJSON = JSON.parse(jsonResult.output);
+                result = expectedJSON.getRoot().equals(outputJSON.getRoot());
+            } catch (ParserException ex) {
+            } catch (IOException ex) {
+            }
+        }
+        return result;
+    }
+}

File src/main/java/cc/plural/json/JSONTestRunner.java

 import cc.plural.json.library.JSONSmartLibrary;
 import cc.plural.json.library.JSONiJLibrary;
 import cc.plural.json.library.JacksonLibrary;
-import cc.plural.json.test.StandardRFC4627ErrorConditions;
-import cc.plural.json.test.StandardRFC4627ParsingJSONTestSet;
-import cc.plural.json.test.StandardRFC4627WhiteSpaceParsingJSONTestSet;
-import cc.plural.json.test.StandardRFDC4627RealExamples;
+import cc.plural.json.test.StrictRFC4627ErrorConditions;
+import cc.plural.json.test.StrictRFC4627ParsingJSONTestSet;
+import cc.plural.json.test.StrictRFC4627WhiteSpaceParsingJSONTestSet;
+import cc.plural.json.test.StrictRFDC4627RealExamples;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Iterator;
 
         // Set up all tests into the suite
         JSONTestSuite<JSONTestSet<JSONTest>> jsonTestSuite = new JSONTestSuite<JSONTestSet<JSONTest>>();
-        jsonTestSuite.add(new StandardRFC4627ParsingJSONTestSet<JSONTest>());
-        jsonTestSuite.add(new StandardRFC4627WhiteSpaceParsingJSONTestSet<JSONTest>());
-        jsonTestSuite.add(new StandardRFC4627ErrorConditions<JSONTest>());
-        jsonTestSuite.add(new StandardRFDC4627RealExamples<JSONTest>());
+        jsonTestSuite.add(new StrictRFC4627ParsingJSONTestSet<JSONTest>());
+        jsonTestSuite.add(new StrictRFC4627WhiteSpaceParsingJSONTestSet<JSONTest>());
+        jsonTestSuite.add(new StrictRFC4627ErrorConditions<JSONTest>());
+        jsonTestSuite.add(new StrictRFDC4627RealExamples<JSONTest>());
         jsonTestSuite.primeAllTestSets();
 
         List<JSONTestSuiteResult<JSONTestSetResult<JSONTestResult>>> testResultsList = new ArrayList<JSONTestSuiteResult<JSONTestSetResult<JSONTestResult>>>();

File src/main/java/cc/plural/json/JSONTestSuite.java

  **/
 package cc.plural.json;
 
-import cc.plural.json.JSONTestResult;
-import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.List;
-import java.util.List;
 
 /**
  *

File src/main/java/cc/plural/json/reporting/HTMLTestReporting.java

+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package cc.plural.json.reporting;
+
+/**
+ *
+ * @author jmarsden
+ */
+public class HTMLTestReporting {
+
+}

File src/main/java/cc/plural/json/test/StandardRFC4627ErrorConditions.java

-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package cc.plural.json.test;
-
-import cc.plural.json.JSONLibrary;
-import cc.plural.json.JSONParseStringInputException;
-import cc.plural.json.JSONParsingTest;
-import cc.plural.json.JSONTest;
-import cc.plural.json.JSONTestResult;
-import cc.plural.json.JSONTestSet;
-
-/**
- *
- * @author jmarsden
- */
-public class StandardRFC4627ErrorConditions<T extends JSONTest> extends JSONTestSet {
-
-    @Override
-    public String getName() {
-        return "Standard RFC4627 Error Condition Test Set";
-    }
-
-    @Override
-    public String getDescription() {
-        return "These tests highlight standard conditions that should cause an error based on the RFC4627 specification.";
-    }
-    
-    @Override
-    public void prime() {
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty String";
-                input = "";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Open Object";
-                input = "{";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Open Array";
-                input = "[";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Unclosed Object";
-                input = "{\"v\":1234";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Object with trailing junk";
-                input = "{\"v\":1234}$ifsisg045";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Array with trailing junk";
-                input = "[1,2,3,4]$ifsisg045";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Unclosed Array";
-                input = "[1,2,3,4";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Tab in JSON String";
-                input = "{\"v\":\"Before\tAfter\"}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Newline in JSON String";
-                input = "{\"v\":\"Before\nAfter\"}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Return in JSON String";
-                input = "{\"v\":\"Before\rAfter\"}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Form Feed in JSON String";
-                input = "{\"v\":\"Before\fAfter\"}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(
-                new JSONParsingTest() {
-
-                    @Override
-                    public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                            throws JSONParseStringInputException {
-                        description = "Same Key Behaviour";
-                        input = "{\"array\":[1,2],\"array\":[3,4]}";
-                        expectedOutputError = true;
-                        return jsonPackage.parseJSONString(input);
-                    }
-                });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Double Exponent Number";
-                input = "{\"v\":1234567890987654321E234E343}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Likely Number";
-                input = "{\"v\":12345678909876A}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Uppercase True";
-                input = "{\"v\":TRUE}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Uppercase False";
-                input = "{\"v\":FALSE}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Uppercase Null";
-                input = "{\"v\":NULL}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Mixed Case True";
-                input = "{\"v\":trUe}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Mixed Case False";
-                input = "{\"v\":faLse}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
-                    throws JSONParseStringInputException {
-                description = "Mixed Case Null";
-                input = "{\"v\":nuLl}";
-                expectedOutputError = true;
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-    }
-}

File src/main/java/cc/plural/json/test/StandardRFC4627ParsingJSONTestSet.java

-/**
- * Copyright (C) 2010-2011 J.W.Marsden
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-package cc.plural.json.test;
-
-import cc.plural.json.JSONLibrary;
-import cc.plural.json.JSONParseStringInputException;
-import cc.plural.json.JSONParsingTest;
-import cc.plural.json.JSONTest;
-import cc.plural.json.JSONTestResult;
-import cc.plural.json.JSONTestSet;
-
-/**
- *
- * @author jmarsden
- */
-public class StandardRFC4627ParsingJSONTestSet<T extends JSONTest> extends JSONTestSet {
-
-    @Override
-    public String getName() {
-        return "Standard RFC4627 Parsing and Serialisation Test Set";
-    }
-
-    @Override
-    public String getDescription() {
-        return "These are common parsing and serialisation cases for the RFC4627 specification.";
-    }
-
-    @Override
-    public void prime() {
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Object";
-                input = "{}";
-                expectedOutput = "{}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Array";
-                input = "[]";
-                expectedOutput = "[]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Integer";
-                input = "{\"v\":1337}";
-                expectedOutput = "{\"v\":1337}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Negative Integer";
-                input = "{\"v\":-5678}";
-                expectedOutput = "{\"v\":-5678}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Decimal";
-                input = "{\"v\":3.1415}";
-                expectedOutput = "{\"v\":3.1415}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Negative Decimal";
-                input = "{\"v\":-0.01223}";
-                expectedOutput = "{\"v\":-0.01223}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple String Value";
-                input = "{\"v\":\"String\"}";
-                expectedOutput = "{\"v\":\"String\"}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Exponent Decimal Value Uppercase";
-                input = "{\"PI\":3.141E100}";
-                expectedOutput = "{\"PI\":3.141E100}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Exponent Decimal Value Lowercase";
-                input = "{\"PI\":3.141e-99}";
-                expectedOutput = "{\"PI\":3.141e-99}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "True Value";
-                input = "{\"v\":true}";
-                expectedOutput = "{\"v\":true}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "False Value";
-                input = "{\"v\":false}";
-                expectedOutput = "{\"v\":false}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Null Value";
-                input = "{\"v\":null}";
-                expectedOutput = "{\"v\":null}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Large Int Value";
-                input = "{\"v\":123456789123456789123456789}";
-                expectedOutput = "{\"v\":123456789123456789123456789}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Huge Int Value";
-                input = "{\"v\":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789}";
-                expectedOutput = "{\"v\":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Large Double Value";
-                input = "{\"v\":123456789123456789123456789.123456789123456789123456789}";
-                expectedOutput = "{\"v\":123456789123456789123456789.123456789123456789123456789}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Huge Double Value";
-                input = "{\"v\":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789.123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789}";
-                expectedOutput = "{\"v\":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789.123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Lowecase Unicode";
-                input = "{\"v\":\"\\u2000\\u20ff\"}";
-                expectedOutput = "{\"v\":\"\\u2000\\u20ff\"}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Uppercase Unicode";
-                input = "{\"v\":\"\\u2000\\u20FF\"}";
-                expectedOutput = "{\"v\":\"\\u2000\\u20FF\"}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Surrogate Pair Unicode";
-                input = "{\"v\":\"\\ud801\\udc01\"}";
-                expectedOutput = "{\"v\":\"\\ud801\\udc01\"}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Number Array";
-                input = "[1,2,3,4,5]";
-                expectedOutput = "[1,2,3,4,5]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Complex Number Array";
-                input = "[1,-1000,45.65,-0.00023,123456789012345678900987654321,34E100,-0.3e-100]";
-                expectedOutput = "[1,-1000,45.65,-0.00023,123456789012345678900987654321,34E100,-0.3e-100]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple String Array";
-                input = "[\"One\",\"2\",\"three\",\"4\",\"five\"]";
-                expectedOutput = "[\"One\",\"2\",\"three\",\"4\",\"five\"]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Boolean Array";
-                input = "[true,true,false,false,true,false]";
-                expectedOutput = "[true,true,false,false,true,false]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Deep Array Array";
-                input = "[[],[[[[[],[],[]]]]],[[],[[[[]]]],[]]]";
-                expectedOutput = "[[],[[[[[],[],[]]]]],[[],[[[[]]]],[]]]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Deep Object Object";
-                input = "{\"v\":{\"v\":{\"v\":{\"v\":{\"v\":{},\"w\":{}}}}}}";
-                expectedOutput = "{\"v\":{\"v\":{\"v\":{\"v\":{\"v\":{},\"w\":{}}}}}}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Mixed Object";
-                input = "{\"array\":[1,0.2,true,false,null,{\"v\":[]}],\"null\":null}";
-                expectedOutput = "{\"array\":[1,0.2,true,false,null,{\"v\":[]}],\"null\":null}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-    }
-}

File src/main/java/cc/plural/json/test/StandardRFC4627WhiteSpaceParsingJSONTestSet.java

-/**
- * Copyright (C) 2010-2011 J.W.Marsden
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-package cc.plural.json.test;
-
-import cc.plural.json.JSONLibrary;
-import cc.plural.json.JSONParseStringInputException;
-import cc.plural.json.JSONParsingTest;
-import cc.plural.json.JSONTest;
-import cc.plural.json.JSONTestResult;
-import cc.plural.json.JSONTestSet;
-
-/**
- *
- * @author jmarsden
- */
-public class StandardRFC4627WhiteSpaceParsingJSONTestSet<T extends JSONTest> extends JSONTestSet {
-
-    @Override
-    public String getName() {
-        return "Standard RFC4627 Parsing and Serialisation With Whitespace Test Set";
-    }
-
-    @Override
-    public String getDescription() {
-        return "These are common parsing and serialisation cases but also include all cases where whitespace is common for the RFC4627 specification.";
-    }
-    
-    @Override
-    public void prime() {
-
-         add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Object With Whitespace";
-                input = " \t\r\n\t { \t\r\n\t } \t\r\n\t ";
-                expectedOutput = " \t\r\n\t { \t\r\n\t } \t\r\n\t ";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Object With Whitespace Before";
-                input = " \t\r\n\t {}";
-                expectedOutput = "{}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Object With Whitespace During";
-                input = "{ \t\r\n\t }";
-                expectedOutput = "{}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Object With Whitespace After";
-                input = "{} \t\r\n\t ";
-                expectedOutput = "{}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Array With Whitespace";
-                input = " \t\r\n\t [ \t\r\n\t ] \t\r\n\t ";
-                expectedOutput = "[]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Array With Whitespace Before";
-                input = " \t\r\n\t []";
-                expectedOutput = "[]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Array With During";
-                input = "[ \t\r\n\t ]";
-                expectedOutput = "[]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Empty Array With Whitespace After";
-                input = "[] \t\r\n\t ";
-                expectedOutput = "[]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Number Array With Whitespace";
-                input = " \t\r\n\t [ \t\r\n\t 1 \t\r\n\t , \t\r\n\t 2 \t\r\n\t , \t\r\n\t 3 \t\r\n\t , \t\r\n\t 4 \t\r\n\t , \t\r\n\t 5 \t\r\n\t ] \t\r\n\t ";
-                expectedOutput = "[1,2,3,4,5]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple String Array With Whitespace";
-                input = " \t\r\n\t [ \t\r\n\t \"One\" \t\r\n\t , \t\r\n\t \"2\" \t\r\n\t , \t\r\n\t \"three\" \t\r\n\t , \t\r\n\t \"4\" \t\r\n\t , \t\r\n\t \"five\" \t\r\n\t ] \t\r\n\t ";
-                expectedOutput = "[\"One\",\"2\",\"three\",\"4\",\"five\"]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Simple Boolean Array With Whitespace";
-                input = " \t\r\n\t [ \t\r\n\t true \t\r\n\t , \t\r\n\t true \t\r\n\t , \t\r\n\t false \t\r\n\t , \t\r\n\t false \t\r\n\t , \t\r\n\t true \t\r\n\t , \t\r\n\t false \t\r\n\t ] \t\r\n\t ";
-                expectedOutput = "[true,true,false,false,true,false]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Complex Number Array With Whitespace";
-                input = " \t\r\n\t [ \t\r\n\t 1 \t\r\n\t , \t\r\n\t -1000 \t\r\n\t , \t\r\n\t 45.65 \t\r\n\t , \t\r\n\t -0.00023 \t\r\n\t , \t\r\n\t 123456789012345678900987654321 \t\r\n\t , \t\r\n\t 34E100 \t\r\n\t , \t\r\n\t -0.3e-100 \t\r\n\t ]";
-                expectedOutput = "[1,-1000,45.65,-0.00023,123456789012345678900987654321,34E100,-0.3e-100]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Deep Array Array With Whitespace";
-                input = "[ \t\r\n\t [ \t\r\n\t ] \t\r\n\t , \t\r\n\t [ \t\r\n\t [ \t\r\n\t [ \t\r\n\t [ \t\r\n\t [ \t\r\n\t ] \t\r\n\t , \t\r\n\t [ \t\r\n\t ] \t\r\n\t , \t\r\n\t [ \t\r\n\t ] \t\r\n\t ] \t\r\n\t ] \t\r\n\t ] \t\r\n\t ] \t\r\n\t , \t\r\n\t [ \t\r\n\t [ \t\r\n\t ] \t\r\n\t , \t\r\n\t [ \t\r\n\t [ \t\r\n\t [ \t\r\n\t [ \t\r\n\t ] \t\r\n\t ] \t\r\n\t ] \t\r\n\t ] \t\r\n\t , \t\r\n\t [ \t\r\n\t ] \t\r\n\t ] \t\r\n\t ]";
-                expectedOutput = "[[],[[[[[],[],[]]]]],[[],[[[[]]]],[]]]";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-
-        add(new JSONParsingTest() {
-
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Deep Object Object";
-                input = "{ \t\r\n\t \"v\" \t\r\n\t : \t\r\n\t { \t\r\n\t \"v\" \t\r\n\t : \t\r\n\t { \t\r\n\t \"v\" \t\r\n\t : \t\r\n\t { \t\r\n\t \"v\" \t\r\n\t : \t\r\n\t { \t\r\n\t \"v\" \t\r\n\t : \t\r\n\t { \t\r\n\t } \t\r\n\t , \t\r\n\t \"w\" \t\r\n\t : \t\r\n\t { \t\r\n\t } \t\r\n\t } \t\r\n\t } \t\r\n\t } \t\r\n\t } \t\r\n\t }";
-                expectedOutput = "{\"v\":{\"v\":{\"v\":{\"v\":{\"v\":{},\"w\":{}}}}}}";
-                return jsonPackage.parseJSONString(input);
-            }
-        });
-    }
-}

File src/main/java/cc/plural/json/test/StandardRFDC4627RealExamples.java

-/**
- * Copyright (C) 2010-2011 J.W.Marsden
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-package cc.plural.json.test;
-
-import cc.plural.json.JSONLibrary;
-import cc.plural.json.JSONParseStringInputException;
-import cc.plural.json.JSONParsingTest;
-import cc.plural.json.JSONTest;
-import cc.plural.json.JSONTestResult;
-import cc.plural.json.JSONTestSet;
-
-/**
- *
- * @author jmarsden
- */
-public class StandardRFDC4627RealExamples<T extends JSONTest> extends JSONTestSet {
-    
-    @Override
-    public String getName() {
-        return "Standard RFC4627 \"Real World\" Parsing and Serialisation Test Set";
-    }
-
-    @Override
-    public String getDescription() {
-        return "These are simulated but realistic parsing and serialisation cases for the RFC4627 specification.";
-    }
-    
-    @Override
-    public void prime() {
-        
-        final String jsonExample1 = "{" + 
-            "\"Image\": {" + 
-            "  \"Width\":  800," + 
-            "  \"Height\": 600," + 
-            "  \"Title\":  \"View from 15th Floor\"," + 
-            "  \"Thumbnail\": {" + 
-            "      \"Url\":    \"http://www.example.com/image/481989943\"," + 
-            "      \"Height\": 125," + 
-            "      \"Width\":  \"100\"" + 
-            "  }," + 
-            "  \"IDs\": [116, 943, 234, 38793]" + 
-            "}" + 
-            "}";
-        
-        final String jsonExample2 = "   [" +
-            "      {" +
-            "         \"precision\": \"zip\"," +
-            "         \"Latitude\":  37.7668," +
-            "         \"Longitude\": -122.3959," +
-            "         \"Address\":   \"\"," +
-            "         \"City\":      \"SAN FRANCISCO\"," +
-            "         \"State\":     \"CA\"," +
-            "         \"Zip\":       \"94107\"," +
-            "         \"Country\":   \"US\"" +
-            "      }," +
-            "      {" +
-            "         \"precision\": \"zip\"," +
-            "         \"Latitude\":  37.371991," +
-            "         \"Longitude\": -122.026020," +
-            "         \"Address\":   \"\"," +
-            "         \"City\":      \"SUNNYVALE\"," +
-            "         \"State\":     \"CA\"," +
-            "         \"Zip\":       \"94085\"," +
-            "         \"Country\":   \"US\"" +
-            "      }" +
-            "   ]";
-        
-        final String wikiPediaExample1 = "{\r\n" +
-             "\"firstName\": \"John\",\r\n" +
-             "\"lastName\": \"Smith\",\r\n" +
-             "\"age\": 25,\r\n" +
-             "\"address\":\r\n" +
-             "{\r\n" +
-                 "\"streetAddress\": \"21 2nd Street\",\r\n" +
-                 "\"city\": \"New York\",\r\n" +
-                 "\"state\": \"NY\",\r\n" +
-                 "\"postalCode\": \"10021\"\r\n" +
-             "},\r\n" +
-             "\"phoneNumber\":\r\n" +
-             "[\r\n" +
-                 "{\r\n" +
-                   "\"type\": \"home\",\r\n" +
-                   "\"number\": \"212 555-1234\"\r\n" +
-                 "},\r\n" +
-                 "{\r\n" +
-                   "\"type\": \"fax\",\r\n" +
-                   "\"number\": \"646 555-4567\"\r\n" +
-                 "}\r\n" +
-             "]\r\n" +
-         "}\r\n";
-
-        add(new JSONParsingTest() {
-            
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "JSON Spec Example One";
-                input = jsonExample1;
-                expectedOutput = jsonExample1;
-                return jsonPackage.parseJSONString(input);
-            }
-        });    
-        
-        add(new JSONParsingTest() {
-            
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "JSON Spec Example Two";
-                input = jsonExample2;
-                expectedOutput = jsonExample2;
-                return jsonPackage.parseJSONString(input);
-            }
-        });    
-        
-        add(new JSONParsingTest() {
-            
-            @Override
-            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
-                description = "Wikipedia JSON Page Example One";
-                input = wikiPediaExample1;
-                expectedOutput = wikiPediaExample1;
-                return jsonPackage.parseJSONString(input);
-            } 
-        });
-    }
-
-}

File src/main/java/cc/plural/json/test/StrictRFC4627ErrorConditions.java

+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package cc.plural.json.test;
+
+import cc.plural.json.JSONLibrary;
+import cc.plural.json.JSONParseStringInputException;
+import cc.plural.json.JSONStringParsingTest;
+import cc.plural.json.JSONTest;
+import cc.plural.json.JSONTestResult;
+import cc.plural.json.JSONTestSet;
+
+/**
+ *
+ * @author jmarsden
+ */
+public class StrictRFC4627ErrorConditions<T extends JSONTest> extends JSONTestSet {
+
+    @Override
+    public String getName() {
+        return "Strict RFC4627 Error Condition Test Set";
+    }
+
+    @Override
+    public String getDescription() {
+        return "These tests highlight standard conditions that should cause an error based on the RFC4627 specification.";
+    }
+
+    @Override
+    public void prime() {
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Empty String";
+                input = "";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Open Object";
+                input = "{";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Open Array";
+                input = "[";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Unclosed Object";
+                input = "{\"v\":1234";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Object with trailing junk";
+                input = "{\"v\":1234}$ifsisg045";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Array with trailing junk";
+                input = "[1,2,3,4]$ifsisg045";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Unclosed Array";
+                input = "[1,2,3,4";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Tab in JSON String";
+                input = "{\"v\":\"Before\tAfter\"}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Newline in JSON String";
+                input = "{\"v\":\"Before\nAfter\"}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Return in JSON String";
+                input = "{\"v\":\"Before\rAfter\"}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Form Feed in JSON String";
+                input = "{\"v\":\"Before\fAfter\"}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Same Key Behaviour";
+                input = "{\"array\":[1,2],\"array\":[3,4]}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Double Exponent Number";
+                input = "{\"v\":1234567890987654321E234E343}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Likely Number";
+                input = "{\"v\":12345678909876A}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Uppercase True";
+                input = "{\"v\":TRUE}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Uppercase False";
+                input = "{\"v\":FALSE}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Uppercase Null";
+                input = "{\"v\":NULL}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Mixed Case True";
+                input = "{\"v\":trUe}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Mixed Case False";
+                input = "{\"v\":faLse}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult)
+                    throws JSONParseStringInputException {
+                description = "Mixed Case Null";
+                input = "{\"v\":nuLl}";
+                expectedOutputError = true;
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+    }
+}

File src/main/java/cc/plural/json/test/StrictRFC4627ParsingJSONTestSet.java

+/**
+ * Copyright (C) 2010-2011 J.W.Marsden
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ **/
+package cc.plural.json.test;
+
+import cc.plural.json.JSONLibrary;
+import cc.plural.json.JSONParseStringInputException;
+import cc.plural.json.JSONStringParsingTest;
+import cc.plural.json.JSONTest;
+import cc.plural.json.JSONTestResult;
+import cc.plural.json.JSONTestSet;
+
+/**
+ *
+ * @author jmarsden
+ */
+public class StrictRFC4627ParsingJSONTestSet<T extends JSONTest> extends JSONTestSet {
+
+    @Override
+    public String getName() {
+        return "Strict RFC4627 Parsing and Serialisation Test Set";
+    }
+
+    @Override
+    public String getDescription() {
+        return "These are common parsing and serialisation cases for the RFC4627 specification.";
+    }
+
+    @Override
+    public void prime() {
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Empty Object";
+                input = "{}";
+                expectedOutput = "{}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Empty Array";
+                input = "[]";
+                expectedOutput = "[]";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Simple Integer";
+                input = "{\"v\":1337}";
+                expectedOutput = "{\"v\":1337}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Simple Negative Integer";
+                input = "{\"v\":-5678}";
+                expectedOutput = "{\"v\":-5678}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Simple Decimal";
+                input = "{\"v\":3.1415}";
+                expectedOutput = "{\"v\":3.1415}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Simple Negative Decimal";
+                input = "{\"v\":-0.01223}";
+                expectedOutput = "{\"v\":-0.01223}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Simple String Value";
+                input = "{\"v\":\"String\"}";
+                expectedOutput = "{\"v\":\"String\"}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Exponent Decimal Value Uppercase";
+                input = "{\"PI\":3.141E100}";
+                expectedOutput = "{\"PI\":3.141E100}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Exponent Decimal Value Lowercase";
+                input = "{\"PI\":3.141e-99}";
+                expectedOutput = "{\"PI\":3.141e-99}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "True Value";
+                input = "{\"v\":true}";
+                expectedOutput = "{\"v\":true}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "False Value";
+                input = "{\"v\":false}";
+                expectedOutput = "{\"v\":false}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Null Value";
+                input = "{\"v\":null}";
+                expectedOutput = "{\"v\":null}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Large Int Value";
+                input = "{\"v\":123456789123456789123456789}";
+                expectedOutput = "{\"v\":123456789123456789123456789}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+
+        add(new JSONStringParsingTest() {
+
+            @Override
+            public String evaluatePayload(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONParseStringInputException {
+                description = "Huge Int Value";
+                input = "{\"v\":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789}";
+                expectedOutput = "{\"v\":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789}";
+                return jsonPackage.parseJSONString(input);
+            }
+        });
+
+        add(new JSONStringParsingTest() {
+