Browse Source

Test should run with default configuration.

pull/57/head
Kalle Stenflo 10 years ago
parent
commit
944ab1f331
  1. 15
      json-path/src/test/java/com/jayway/jsonpath/old/FilterTest.java
  2. 2
      json-path/src/test/java/com/jayway/jsonpath/old/IssuesTest.java
  3. 51
      json-path/src/test/java/com/jayway/jsonpath/old/internal/PredicatePathTokenTest.java
  4. 4
      json-path/src/test/java/com/jayway/jsonpath/old/internal/ScanPathTokenTest.java
  5. 4
      json-path/src/test/java/com/jayway/jsonpath/old/internal/TestBase.java

15
json-path/src/test/java/com/jayway/jsonpath/old/FilterTest.java

@ -60,15 +60,10 @@ public class FilterTest extends BaseTest {
" }\n" + " }\n" +
"}"; "}";
private static final JsonProvider jp = new JsonSmartJsonProvider();
private static final Configuration conf = Configuration.defaultConfiguration(); private static final Configuration conf = Configuration.defaultConfiguration();
//-------------------------------------------------
// private static final JsonProvider jp = conf.jsonProvider();
// Single filter tests
//
//-------------------------------------------------
@Test
public void is_filters_evaluates() throws Exception { public void is_filters_evaluates() throws Exception {
final Map<String, Object> check = new HashMap<String, Object>(); final Map<String, Object> check = new HashMap<String, Object>();
check.put("foo", "foo"); check.put("foo", "foo");
@ -380,7 +375,7 @@ public class FilterTest extends BaseTest {
@Test @Test
public void filters_can_contain_json_path_expressions() throws Exception { public void filters_can_contain_json_path_expressions() throws Exception {
Object doc = new JsonSmartJsonProvider().parse(DOCUMENT); Object doc = Configuration.defaultConfiguration().jsonProvider().parse(DOCUMENT);
assertFalse(filter(where("$.store.bicycle.color").ne("red")).apply(createPredicateContext(doc))); assertFalse(filter(where("$.store.bicycle.color").ne("red")).apply(createPredicateContext(doc)));
} }
@ -410,7 +405,7 @@ public class FilterTest extends BaseTest {
"}\n"; "}\n";
Object doc = new JsonSmartJsonProvider().parse(json); Object doc = Configuration.defaultConfiguration().jsonProvider().parse(json);
List<Map<String, Object>> result = JsonPath.read(doc, "$.fields[?]", filter(where("errors").notEmpty())); List<Map<String, Object>> result = JsonPath.read(doc, "$.fields[?]", filter(where("errors").notEmpty()));
assertEquals(1, result.size()); assertEquals(1, result.size());

2
json-path/src/test/java/com/jayway/jsonpath/old/IssuesTest.java

@ -28,7 +28,7 @@ import static org.junit.Assert.assertThat;
public class IssuesTest { public class IssuesTest {
private static final JsonProvider jp = new JsonSmartJsonProvider(); private static final JsonProvider jp = Configuration.defaultConfiguration().jsonProvider();
@Test @Test
public void full_ones_can_be_filtered() { public void full_ones_can_be_filtered() {

51
json-path/src/test/java/com/jayway/jsonpath/old/internal/PredicatePathTokenTest.java

@ -1,5 +1,6 @@
package com.jayway.jsonpath.old.internal; package com.jayway.jsonpath.old.internal;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.internal.spi.json.JsonSmartJsonProvider; import com.jayway.jsonpath.internal.spi.json.JsonSmartJsonProvider;
import org.junit.Test; import org.junit.Test;
@ -13,32 +14,32 @@ import static org.assertj.core.api.Assertions.entry;
public class PredicatePathTokenTest { public class PredicatePathTokenTest {
private static final Object ARRAY = new JsonSmartJsonProvider().parse( private static final Object ARRAY = Configuration.defaultConfiguration().jsonProvider().parse(
"[" + "[" +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-0\"\n" + " \"foo\" : \"foo-val-0\"\n" +
"}," + "}," +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-1\"\n" + " \"foo\" : \"foo-val-1\"\n" +
"}," + "}," +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-2\"\n" + " \"foo\" : \"foo-val-2\"\n" +
"}," + "}," +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-3\"\n" + " \"foo\" : \"foo-val-3\"\n" +
"}," + "}," +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-4\"\n" + " \"foo\" : \"foo-val-4\"\n" +
"}," + "}," +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-5\"\n" + " \"foo\" : \"foo-val-5\"\n" +
"}," + "}," +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-6\"\n" + " \"foo\" : \"foo-val-6\"\n" +
"}" + "}" +
"]"); "]");
private static Object ARRAY2 = new JsonSmartJsonProvider().parse( private static Object ARRAY2 = Configuration.defaultConfiguration().jsonProvider().parse(
"[" + "[" +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-0\",\n" + " \"foo\" : \"foo-val-0\",\n" +

4
json-path/src/test/java/com/jayway/jsonpath/old/internal/ScanPathTokenTest.java

@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ScanPathTokenTest { public class ScanPathTokenTest {
public final static Object DOCUMENT = new JsonSmartJsonProvider().parse( public final static Object DOCUMENT = Configuration.defaultConfiguration().jsonProvider().parse(
"{\n" + "{\n" +
" \"store\":{\n" + " \"store\":{\n" +
" \"book\":[\n" + " \"book\":[\n" +
@ -64,7 +64,7 @@ public class ScanPathTokenTest {
"}" "}"
); );
public final static Object DOCUMENT2 = new JsonSmartJsonProvider().parse( public final static Object DOCUMENT2 = Configuration.defaultConfiguration().jsonProvider().parse(
"{\n" + "{\n" +
" \"firstName\": \"John\",\n" + " \"firstName\": \"John\",\n" +
" \"lastName\" : \"doe\",\n" + " \"lastName\" : \"doe\",\n" +

4
json-path/src/test/java/com/jayway/jsonpath/old/internal/TestBase.java

@ -9,7 +9,7 @@ import com.jayway.jsonpath.internal.spi.json.JsonSmartJsonProvider;
public class TestBase { public class TestBase {
public final static Object ARRAY = new JsonSmartJsonProvider().parse("[" + public final static Object ARRAY = Configuration.defaultConfiguration().jsonProvider().parse("[" +
"{\n" + "{\n" +
" \"foo\" : \"foo-val-0\"\n" + " \"foo\" : \"foo-val-0\"\n" +
"}," + "}," +
@ -33,7 +33,7 @@ public class TestBase {
"}" + "}" +
"]"); "]");
public final static Object DOC = new JsonSmartJsonProvider().parse( public final static Object DOC = Configuration.defaultConfiguration().jsonProvider().parse(
"{ \"store\": {\n" + "{ \"store\": {\n" +
" \"book\": [ \n" + " \"book\": [ \n" +
" { \"category\": \"reference\",\n" + " { \"category\": \"reference\",\n" +

Loading…
Cancel
Save