From dc846258da38bb5b74036772a445d0f455226155 Mon Sep 17 00:00:00 2001 From: kalle Date: Mon, 24 Jan 2011 21:45:54 +0100 Subject: [PATCH] Extracted interfaces for Asserter and Reader --- .../com/jayway/jsonassert/JSONAssert.java | 27 ++++++ .../jsonassert/{impl => }/JSONAsserter.java | 61 +++---------- .../com/jayway/jsonassert/JSONReader.java | 70 +++++++++++++++ .../jsonassert/impl/JSONAsserterImpl.java | 86 +++++++++++++++++++ .../com/jayway/jsonassert/impl/JSONPath.java | 4 +- .../jsonassert/impl/JSONPathFragment.java | 8 +- .../{JSONReader.java => JSONReaderImpl.java} | 35 ++++++-- .../jayway/jsonassert/JSONAsserterTest.java | 16 ++-- .../com/jayway/jsonassert/JSONReaderTest.java | 48 +++++------ 9 files changed, 265 insertions(+), 90 deletions(-) create mode 100644 json-assert/src/main/java/com/jayway/jsonassert/JSONAssert.java rename json-assert/src/main/java/com/jayway/jsonassert/{impl => }/JSONAsserter.java (57%) create mode 100644 json-assert/src/main/java/com/jayway/jsonassert/JSONReader.java create mode 100644 json-assert/src/main/java/com/jayway/jsonassert/impl/JSONAsserterImpl.java rename json-assert/src/main/java/com/jayway/jsonassert/impl/{JSONReader.java => JSONReaderImpl.java} (87%) diff --git a/json-assert/src/main/java/com/jayway/jsonassert/JSONAssert.java b/json-assert/src/main/java/com/jayway/jsonassert/JSONAssert.java new file mode 100644 index 00000000..f5c9308c --- /dev/null +++ b/json-assert/src/main/java/com/jayway/jsonassert/JSONAssert.java @@ -0,0 +1,27 @@ +package com.jayway.jsonassert; + +import com.jayway.jsonassert.impl.JSONAsserterImpl; + +import java.text.ParseException; + +/** + * Created by IntelliJ IDEA. + * User: kallestenflo + * Date: 1/24/11 + * Time: 9:31 PM + */ +public class JSONAssert { + + /** + * Creates a JSONAsserter instance that can be used to make + * assertions on the provided JSON document or array. + * + * @param json the JSON document to create a JSONAsserter for + * @return a JSON asserter initialized with the provided document + * @throws ParseException when the given JSON could not be parsed + */ + public static JSONAsserter with(String json) throws ParseException { + return JSONAsserterImpl.with(json); + } + +} diff --git a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONAsserter.java b/json-assert/src/main/java/com/jayway/jsonassert/JSONAsserter.java similarity index 57% rename from json-assert/src/main/java/com/jayway/jsonassert/impl/JSONAsserter.java rename to json-assert/src/main/java/com/jayway/jsonassert/JSONAsserter.java index dacde631..18414d7a 100644 --- a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONAsserter.java +++ b/json-assert/src/main/java/com/jayway/jsonassert/JSONAsserter.java @@ -1,42 +1,21 @@ -package com.jayway.jsonassert.impl; - +package com.jayway.jsonassert; import org.hamcrest.Matcher; -import org.hamcrest.MatcherAssert; - -import java.text.ParseException; - -import static org.hamcrest.Matchers.*; /** - * User: kalle stenflo - * Date: 1/21/11 - * Time: 3:43 PM + * Created by IntelliJ IDEA. + * User: kallestenflo + * Date: 1/24/11 + * Time: 9:22 PM */ -public class JSONAsserter { - - private final JSONReader reader; +public interface JSONAsserter { /** - * Creates a new instance of a JSONAsserter that can be used to make - * assertions on the provided JSON document or array. + * Gives access to the {@link JSONReader} used to base the assertions on * - * @param json the JSON document to create a JSONAsserter for - * @return a JSON asserter initialized with the provided document - * @throws ParseException + * @return the underlying reader */ - public static JSONAsserter with(String json) throws ParseException { - return new JSONAsserter(JSONReader.parse(json)); - } - - /** - * Instantiates a new JSONAsserter - * - * @param reader initialized with the JSON document to be asserted upon - */ - private JSONAsserter(JSONReader reader) { - this.reader = reader; - } + JSONReader reader(); /** * Asserts that object specified by path satisfies the condition specified by matcher. @@ -53,10 +32,7 @@ public class JSONAsserter { * @param the static type accepted by the matcher * @return this to allow fluent assertion chains */ - public JSONAsserter assertThat(String path, Matcher matcher) { - MatcherAssert.assertThat((T) reader.get(path), matcher); - return this; - } + JSONAsserter assertThat(String path, Matcher matcher); /** * Asserts that object specified by path is equal to the expected value. @@ -67,9 +43,7 @@ public class JSONAsserter { * @param the static type that should be returned by the path * @return this to allow fluent assertion chains */ - public JSONAsserter assertEquals(String path, T expected) { - return assertThat(path, equalTo(expected)); - } + JSONAsserter assertEquals(String path, T expected); /** * Asserts that object specified by path is null. If it is not, an AssertionError @@ -78,9 +52,7 @@ public class JSONAsserter { * @param path the json path specifying the value that should be null * @return this to allow fluent assertion chains */ - public JSONAsserter assertNull(String path) { - return assertThat(path, nullValue()); - } + JSONAsserter assertNull(String path); /** * Asserts that object specified by path is NOT null. If it is, an AssertionError @@ -89,9 +61,7 @@ public class JSONAsserter { * @param path the json path specifying the value that should be NOT null * @return this to allow fluent assertion chains */ - public JSONAsserter assertNotNull(String path) { - return assertThat(path, notNullValue()); - } + JSONAsserter assertNotNull(String path); /** * Syntactic sugar to allow chaining assertions with a separating and() statement @@ -103,8 +73,5 @@ public class JSONAsserter { * * @return this to allow fluent assertion chains */ - public JSONAsserter and() { - return this; - } - + JSONAsserter and(); } diff --git a/json-assert/src/main/java/com/jayway/jsonassert/JSONReader.java b/json-assert/src/main/java/com/jayway/jsonassert/JSONReader.java new file mode 100644 index 00000000..878f490a --- /dev/null +++ b/json-assert/src/main/java/com/jayway/jsonassert/JSONReader.java @@ -0,0 +1,70 @@ +package com.jayway.jsonassert; + +import java.util.List; +import java.util.Map; + +/** + * Created by IntelliJ IDEA. + * User: kallestenflo + * Date: 1/24/11 + * Time: 9:29 PM + */ +public interface JSONReader { + + /** + * + * @param path + * @return + */ + boolean hasJsonPath(String path); + + /** + * + * @param path + * @return + */ + boolean isNull(String path); + + /** + * + * @param path + * @return + */ + Object get(String path); + + /** + * + * @param path + * @return + */ + String getString(String path); + + /** + * + * @param path + * @return + */ + Long getLong(String path); + + /** + * + * @param path + * @return + */ + Boolean getBoolean(String path); + + /** + * + * @param path + * @param + * @return + */ + List getList(String path); + + /** + * + * @param path + * @return + */ + Map getMap(String path); +} diff --git a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONAsserterImpl.java b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONAsserterImpl.java new file mode 100644 index 00000000..d68680e7 --- /dev/null +++ b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONAsserterImpl.java @@ -0,0 +1,86 @@ +package com.jayway.jsonassert.impl; + + +import com.jayway.jsonassert.JSONAsserter; +import com.jayway.jsonassert.JSONReader; +import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; + +import java.text.ParseException; + +import static org.hamcrest.Matchers.*; + +/** + * User: kalle stenflo + * Date: 1/21/11 + * Time: 3:43 PM + */ +public class JSONAsserterImpl implements JSONAsserter { + + private final JSONReader reader; + + /** + * Creates a new instance of a JSONAsserter that can be used to make + * assertions on the provided JSON document or array. + * + * @param json the JSON document to create a JSONAsserter for + * @return a JSON asserter initialized with the provided document + * @throws ParseException + */ + public static JSONAsserter with(String json) throws ParseException { + return new JSONAsserterImpl(JSONReaderImpl.parse(json)); + } + + /** + * Instantiates a new JSONAsserter + * + * @param reader initialized with the JSON document to be asserted upon + */ + private JSONAsserterImpl(JSONReader reader) { + this.reader = reader; + } + + /** + * {@inheritDoc} + */ + public JSONReader reader() { + return reader; + } + + /** + * {@inheritDoc} + */ + public JSONAsserter assertThat(String path, Matcher matcher) { + MatcherAssert.assertThat((T) reader.get(path), matcher); + return this; + } + + /** + * {@inheritDoc} + */ + public JSONAsserter assertEquals(String path, T expected) { + return assertThat(path, equalTo(expected)); + } + + /** + * {@inheritDoc} + */ + public JSONAsserter assertNull(String path) { + return assertThat(path, nullValue()); + } + + /** + * {@inheritDoc} + */ + public JSONAsserter assertNotNull(String path) { + return assertThat(path, notNullValue()); + } + + /** + * {@inheritDoc} + */ + public JSONAsserter and() { + return this; + } + +} diff --git a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPath.java b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPath.java index 1696ff76..07a8130d 100644 --- a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPath.java +++ b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPath.java @@ -16,11 +16,11 @@ class JSONPath { this.path = compilePathFragments(path); } - public boolean hasMoreFragments(){ + boolean hasMoreFragments(){ return !path.isEmpty(); } - public JSONPathFragment nextFragment(){ + JSONPathFragment nextFragment(){ return path.poll(); } diff --git a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPathFragment.java b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPathFragment.java index 58029c05..60be55b9 100644 --- a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPathFragment.java +++ b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONPathFragment.java @@ -22,19 +22,19 @@ class JSONPathFragment { this.fragment = fragment; } - public String fragment() { + String fragment() { return fragment; } - public boolean isArrayIndex() { + boolean isArrayIndex() { return ARRAY_POSITION_PATTER.matcher(fragment).matches() || GROOVY_POSITION_PATTER.matcher(fragment).matches(); } - public boolean isArrayWildcard() { + boolean isArrayWildcard() { return ARRAY_WILDCARD_PATTER.matcher(fragment).matches() || GROOVY_WILDCARD_PATTER.matcher(fragment).matches(); } - public int getArrayIndex() { + int getArrayIndex() { Matcher matcher = ARRAY_POSITION_PATTER.matcher(fragment); if (matcher.matches()) { return Integer.parseInt(matcher.group(1)); diff --git a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONReader.java b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONReaderImpl.java similarity index 87% rename from json-assert/src/main/java/com/jayway/jsonassert/impl/JSONReader.java rename to json-assert/src/main/java/com/jayway/jsonassert/impl/JSONReaderImpl.java index 57a07b4e..4bb27d1f 100644 --- a/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONReader.java +++ b/json-assert/src/main/java/com/jayway/jsonassert/impl/JSONReaderImpl.java @@ -1,6 +1,7 @@ package com.jayway.jsonassert.impl; import com.jayway.jsonassert.InvalidPathException; +import com.jayway.jsonassert.JSONReader; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -17,7 +18,7 @@ import static org.apache.commons.lang.Validate.notNull; * Date: 1/20/11 * Time: 4:27 PM */ -public class JSONReader { +public class JSONReaderImpl implements JSONReader { private static final JSONParser JSON_PARSER = new JSONParser(); @@ -27,12 +28,15 @@ public class JSONReader { public static JSONReader parse(String jsonDoc) throws java.text.ParseException { try { - return new JSONReader(JSON_PARSER.parse(jsonDoc)); + return new JSONReaderImpl(JSON_PARSER.parse(jsonDoc)); } catch (ParseException e) { throw new java.text.ParseException(e.getMessage(), e.getPosition()); } } + /** + * {@inheritDoc} + */ public boolean hasJsonPath(String path) { boolean contains = true; try { @@ -43,30 +47,51 @@ public class JSONReader { return contains; } - public boolean isNull(String path){ + /** + * {@inheritDoc} + */ + public boolean isNull(String path) { return (null == get(path)); } + /** + * {@inheritDoc} + */ public Object get(String path) { return getByPath(Object.class, path); } + /** + * {@inheritDoc} + */ public String getString(String path) { return getByPath(String.class, path); } + /** + * {@inheritDoc} + */ public Long getLong(String path) { return getByPath(Long.class, path); } + /** + * {@inheritDoc} + */ public Boolean getBoolean(String path) { return getByPath(Boolean.class, path); } + /** + * {@inheritDoc} + */ public List getList(String path) { return getByPath(List.class, path); } + /** + * {@inheritDoc} + */ public Map getMap(String path) { return getByPath(Map.class, path); } @@ -77,7 +102,7 @@ public class JSONReader { // private methods // //------------------------------------------------------------ - private JSONReader(Object root) { + private JSONReaderImpl(Object root) { notNull(root, "root object can not be null"); this.root = root; } @@ -130,7 +155,7 @@ public class JSONReader { } else if (container instanceof JSONObject) { JSONObject document = getDocument(container); - if(!document.containsKey(field)){ + if (!document.containsKey(field)) { throw new InvalidPathException(); } diff --git a/json-assert/src/test/java/com/jayway/jsonassert/JSONAsserterTest.java b/json-assert/src/test/java/com/jayway/jsonassert/JSONAsserterTest.java index c47f1348..481f32b8 100644 --- a/json-assert/src/test/java/com/jayway/jsonassert/JSONAsserterTest.java +++ b/json-assert/src/test/java/com/jayway/jsonassert/JSONAsserterTest.java @@ -1,6 +1,6 @@ package com.jayway.jsonassert; -import com.jayway.jsonassert.impl.JSONAsserter; +import com.jayway.jsonassert.impl.JSONAsserterImpl; import org.junit.Test; import static org.hamcrest.Matchers.*; @@ -18,44 +18,44 @@ public class JSONAsserterTest { @Test public void a_path_can_be_asserted_with_matcher() throws Exception { - JSONAsserter.with(TEST_DOCUMENT).assertThat("stringField", equalTo("string-field")); + JSONAsserterImpl.with(TEST_DOCUMENT).assertThat("stringField", equalTo("string-field")); } @Test public void array_content_can_be_asserted_with_matcher() throws Exception { - JSONAsserter.with(TEST_DOCUMENT).assertThat("stringList", hasItems("ONE", "TWO")); + JSONAsserterImpl.with(TEST_DOCUMENT).assertThat("stringList", hasItems("ONE", "TWO")); } @Test public void map_content_can_be_asserted_with_matcher() throws Exception { - JSONAsserter.with(TEST_DOCUMENT).assertThat("subDocument", hasEntry("subField", "sub-field")); + JSONAsserterImpl.with(TEST_DOCUMENT).assertThat("subDocument", hasEntry("subField", "sub-field")); } @Test public void a_path_can_be_asserted_equal_to() throws Exception { - JSONAsserter.with(TEST_DOCUMENT).assertEquals("stringField", "string-field"); + JSONAsserterImpl.with(TEST_DOCUMENT).assertEquals("stringField", "string-field"); } @Test public void a_path_can_be_asserted_is_null() throws Exception { - JSONAsserter.with(TEST_DOCUMENT).assertNull("nullField"); + JSONAsserterImpl.with(TEST_DOCUMENT).assertNull("nullField"); } @Test(expected = AssertionError.class) public void failed_assert_throws() throws Exception { - JSONAsserter.with(TEST_DOCUMENT).assertThat("stringField", equalTo("SOME CRAP")); + JSONAsserterImpl.with(TEST_DOCUMENT).assertThat("stringField", equalTo("SOME CRAP")); } @Test public void multiple_asserts_can_be_chained() throws Exception { - JSONAsserter.with(TEST_DOCUMENT) + JSONAsserterImpl.with(TEST_DOCUMENT) .assertThat("stringField", equalTo("string-field")) .and() .assertNull("nullField") diff --git a/json-assert/src/test/java/com/jayway/jsonassert/JSONReaderTest.java b/json-assert/src/test/java/com/jayway/jsonassert/JSONReaderTest.java index a9de5c80..bb3a8814 100644 --- a/json-assert/src/test/java/com/jayway/jsonassert/JSONReaderTest.java +++ b/json-assert/src/test/java/com/jayway/jsonassert/JSONReaderTest.java @@ -1,6 +1,6 @@ package com.jayway.jsonassert; -import com.jayway.jsonassert.impl.JSONReader; +import com.jayway.jsonassert.impl.JSONReaderImpl; import org.junit.Test; import java.text.ParseException; @@ -24,26 +24,26 @@ public class JSONReaderTest { @Test(expected = ParseException.class) public void invalid_json_not_accepted() throws Exception { - JSONReader.parse("not json"); + JSONReaderImpl.parse("not json"); } @Test public void a_string_field_can_be_accessed() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("string-field", reader.getString("stringField")); } @Test public void is_null_returns_true_for_null_fields() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertTrue(reader.isNull("nullField")); } @Test public void is_null_returns_false_for_not_null_fields() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertFalse(reader.isNull("stringField")); } @@ -51,42 +51,42 @@ public class JSONReaderTest { @Test public void a_long_field_can_be_accessed() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertTrue(1234L == reader.getLong("numberField")); } @Test public void a_boolean_field_can_be_accessed() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals(true, reader.getBoolean("booleanField")); } @Test public void a_path_can_be_checked_for_existence() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DEEP_PATH_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DEEP_PATH_DOCUMENT); assertTrue(reader.hasJsonPath("a.b.c.say")); } @Test public void a_path_can_be_checked_for_non_existence() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DEEP_PATH_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DEEP_PATH_DOCUMENT); assertFalse(reader.hasJsonPath("a.b.c.FOO")); } @Test public void a_string_field_can_be_accessed_in_a_nested_document() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("sub-field", reader.getString("subDocument.subField")); } @Test public void a_list_can_be_accessed_in_a_document() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); List l = reader.getList("stringList"); @@ -95,7 +95,7 @@ public class JSONReaderTest { @Test public void a_list_can_be_accessed_by_array_index() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("ONE", reader.getString("stringList[0]")); @@ -104,7 +104,7 @@ public class JSONReaderTest { @Test public void a_list_can_be_accessed_by_groovy_index() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("ONE", reader.getString("stringList.get(0)")); @@ -113,21 +113,21 @@ public class JSONReaderTest { @Test public void a_document_contained_in_a_list_can_be_accessed_by_array_index() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("sub-field-0", reader.getString("objectList[0].subField")); } @Test public void a_document_contained_in_a_list_can_be_accessed_by_groovy_index() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("sub-field-0", reader.getString("objectList.get(0).subField")); } @Test public void an_array_in_an_array_can_be_accessed_by_array_index() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT_ARRAY); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT_ARRAY); assertEquals("0.0", reader.getString("listList[0][0]")); assertEquals("0.1", reader.getString("listList[0][1]")); @@ -137,7 +137,7 @@ public class JSONReaderTest { @Test public void an_array_in_an_array_can_be_accessed_by_groovy_index() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT_ARRAY); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT_ARRAY); assertEquals("0.0", reader.getString("listList.get(0).get(0)")); assertEquals("0.1", reader.getString("listList.get(0).get(1)")); @@ -147,7 +147,7 @@ public class JSONReaderTest { @Test public void an_array_with_documents_can_be_accessed_by_index() throws Exception { - JSONReader reader = JSONReader.parse(TEST_ARRAY); + JSONReader reader = JSONReaderImpl.parse(TEST_ARRAY); assertEquals("name0", reader.getString("[0].name")); assertEquals("name1", reader.getString("[1].name")); @@ -155,7 +155,7 @@ public class JSONReaderTest { @Test public void a_nested_document_can_be_accessed_as_a_map() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("sub-field", reader.getMap("subDocument").get("subField")); } @@ -163,7 +163,7 @@ public class JSONReaderTest { @Test public void every_thing_can_be_fetched_as_object() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals(true, reader.get("booleanField")); assertEquals(1234L, reader.get("numberField")); @@ -172,14 +172,14 @@ public class JSONReaderTest { @Test public void a_deep_document_path_can_be_read() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DEEP_PATH_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DEEP_PATH_DOCUMENT); assertEquals("hello", reader.getString("a.b.c.say")); } @Test(expected = InvalidPathException.class) public void exception_is_thrown_when_field_is_not_found() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); String s = reader.getString("invalidProperty"); @@ -190,7 +190,7 @@ public class JSONReaderTest { @Test public void array_wildcard_property_extract() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); List l = reader.getList("objectList[*].subField"); @@ -211,7 +211,7 @@ public class JSONReaderTest { @Test public void list_to_string_returns_json() throws Exception { - JSONReader reader = JSONReader.parse(TEST_DOCUMENT); + JSONReader reader = JSONReaderImpl.parse(TEST_DOCUMENT); assertEquals("[\"ONE\",\"TWO\"]", reader.getList("stringList").toString());