|
|
|
@ -9,6 +9,7 @@ import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
import com.jayway.jsonpath.BaseTest; |
|
|
|
|
import com.jayway.jsonpath.Criteria; |
|
|
|
|
import com.jayway.jsonpath.DocumentContext; |
|
|
|
|
import com.jayway.jsonpath.Filter; |
|
|
|
|
import com.jayway.jsonpath.JsonPath; |
|
|
|
|
|
|
|
|
@ -20,8 +21,10 @@ public class JsonReaderTest extends BaseTest {
|
|
|
|
|
Filter feq = Filter.filter(Criteria.where("category").eq("reference")); |
|
|
|
|
Filter fne = Filter.filter(Criteria.where("category").ne("reference")); |
|
|
|
|
|
|
|
|
|
List<String> eq = JsonPath.parse(JSON_DOCUMENT).read("$.store.book[?].category", feq); |
|
|
|
|
List<String> ne = JsonPath.parse(JSON_DOCUMENT).read("$.store.book[?].category", fne); |
|
|
|
|
DocumentContext JsonDoc = JsonPath.parse(JSON_DOCUMENT); |
|
|
|
|
|
|
|
|
|
List<String> eq = JsonDoc.read("$.store.book[?].category", feq); |
|
|
|
|
List<String> ne = JsonDoc.read("$.store.book[?].category", fne); |
|
|
|
|
|
|
|
|
|
Assertions.assertThat(eq).contains("reference"); |
|
|
|
|
Assertions.assertThat(ne).doesNotContain("reference"); |
|
|
|
|