Browse Source

update unit test

pull/909/head
Dat Vu 2 years ago committed by GitHub
parent
commit
50688b852d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      json-path/src/test/java/com/jayway/jsonpath/Issue_908

25
json-path/src/test/java/com/jayway/jsonpath/Issue_908

@ -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…
Cancel
Save