1 changed files with 25 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||||
|
package com.jayway.jsonpath; |
||||||
|
|
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
public class Issue_908 { |
||||||
|
|
||||||
|
@Test(expected = InvalidPathException.class) |
||||||
|
public void test_when_current_context_is_null() { |
||||||
|
JsonPath |
||||||
|
.parse("{\"test\" : null }") |
||||||
|
.read("$.test[?(@ != null)]"); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
public void test_suppress_exception_when_current_context_is_null() { |
||||||
|
|
||||||
|
Object rs = JsonPath.using(Configuration.builder() |
||||||
|
.options(Option.SUPPRESS_EXCEPTIONS).build()) |
||||||
|
.parse("{\"test\" : null }") |
||||||
|
.read("$.test[?(@ != null)]"); |
||||||
|
System.out.println(rs); |
||||||
|
assert(rs.toString().equals("[]")); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue