|
|
@ -4,8 +4,10 @@ import org.apache.commons.lang.StringUtils; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.equalTo; |
|
|
|
import static org.hamcrest.Matchers.equalTo; |
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.hasEntry; |
|
|
|
import static org.hamcrest.Matchers.hasItems; |
|
|
|
import static org.hamcrest.Matchers.hasItems; |
|
|
|
import static org.junit.Assert.*; |
|
|
|
import static org.junit.Assert.*; |
|
|
|
|
|
|
|
|
|
|
@ -53,12 +55,10 @@ public class JsonPathTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void read_document_from_root() throws Exception { |
|
|
|
public void read_document_from_root() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Object> list = JsonPath.read(DOCUMENT, "$.store"); |
|
|
|
|
|
|
|
|
|
|
|
JsonPath path = JsonPath.compile("$.store"); |
|
|
|
assertEquals(2, ((Map)list.get(0)).values().size()); |
|
|
|
|
|
|
|
|
|
|
|
List<Object> list = path.read(DOCUMENT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(list.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|