Browse Source

Added tests for issue #141

pull/183/merge
Kalle Stenflo 9 years ago
parent
commit
4dbed10bef
  1. 12
      json-path/src/test/java/com/jayway/jsonpath/FilterTest.java

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

@ -670,4 +670,16 @@ public class FilterTest extends BaseTest {
assertThat(filter).isEqualTo(parsed); assertThat(filter).isEqualTo(parsed);
} }
@Test
public void testFilterWithOrShortCircuit1() throws Exception {
Object json = Configuration.defaultConfiguration().jsonProvider().parse( "{\"firstname\":\"Bob\",\"surname\":\"Smith\",\"age\":30}");
assertThat(Filter.parse("[?((@.firstname == 'Bob' || @.firstname == 'Jane') && @.surname == 'Doe')]").apply(createPredicateContext(json))).isFalse();
}
@Test
public void testFilterWithOrShortCircuit2() throws Exception {
Object json = Configuration.defaultConfiguration().jsonProvider().parse("{\"firstname\":\"Bob\",\"surname\":\"Smith\",\"age\":30}");
assertThat(Filter.parse("[?((@.firstname == 'Bob' || @.firstname == 'Jane') && @.surname == 'Smith')]").apply(createPredicateContext(json))).isTrue();
}
} }

Loading…
Cancel
Save