|
|
@ -31,6 +31,7 @@ import static com.jayway.jsonpath.Criteria.PredicateContext; |
|
|
|
import static com.jayway.jsonpath.Criteria.where; |
|
|
|
import static com.jayway.jsonpath.Criteria.where; |
|
|
|
import static com.jayway.jsonpath.Filter.filter; |
|
|
|
import static com.jayway.jsonpath.Filter.filter; |
|
|
|
import static com.jayway.jsonpath.JsonPath.read; |
|
|
|
import static com.jayway.jsonpath.JsonPath.read; |
|
|
|
|
|
|
|
import static com.jayway.jsonpath.JsonPath.using; |
|
|
|
import static junit.framework.Assert.assertNull; |
|
|
|
import static junit.framework.Assert.assertNull; |
|
|
|
import static junit.framework.Assert.assertTrue; |
|
|
|
import static junit.framework.Assert.assertTrue; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
@ -957,4 +958,26 @@ public class IssuesTest extends BaseTest { |
|
|
|
String object = path.read(json); |
|
|
|
String object = path.read(json); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void issue_170() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String json = "{\n" + |
|
|
|
|
|
|
|
" \"array\": [\n" + |
|
|
|
|
|
|
|
" 0,\n" + |
|
|
|
|
|
|
|
" 1,\n" + |
|
|
|
|
|
|
|
" 2\n" + |
|
|
|
|
|
|
|
" ]\n" + |
|
|
|
|
|
|
|
"}"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DocumentContext context = using(JACKSON_JSON_NODE_CONFIGURATION).parse(json); |
|
|
|
|
|
|
|
context = context.set("$.array[0]", null); |
|
|
|
|
|
|
|
context = context.set("$.array[2]", null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> list = context.read("$.array", List.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(list).containsExactly(null, 1, null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|