JsonPath仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
705 B

package com.jayway.jsonpath;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Created by IntelliJ IDEA.
* User: kallestenflo
* Date: 2/3/11
* Time: 9:58 PM
*/
public class IsDefinitePathTest {
@Test
public void path_is_not_definite() throws Exception {
assertFalse(JsonPath.compile("$..book[0]").isPathDefinite());
assertFalse(JsonPath.compile("$.books[*]").isPathDefinite());
}
@Test
public void path_is_definite() throws Exception {
assertTrue(JsonPath.compile("$.definite.this.is").isPathDefinite());
assertTrue(JsonPath.compile("rows[0].id").isPathDefinite());
}
}