use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testNotFoundTracedQuery.
@Test
public void testNotFoundTracedQuery() {
JsonObject child2 = new JsonObject().put("child5", 1);
JsonArray child1 = new JsonArray().add(child2);
JsonObject root = new JsonObject().put("child1", child1);
JsonPointer pointer = JsonPointer.create().append("child1").append("0").append("child3");
List<Object> traced = pointer.tracedQuery(root, JsonPointerIterator.JSON_ITERATOR);
assertEquals(3, traced.size());
assertSame(root, traced.get(0));
assertSame(child1, traced.get(1));
assertSame(child2, traced.get(2));
}
use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testEncodingParsing.
@Test
public void testEncodingParsing() {
JsonPointer pointer = JsonPointer.create().append("hell/o").append("worl~d");
assertEquals("/hell~1o/worl~0d", pointer.toString());
}
use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testIsParentWithRootPointer.
@Test
public void testIsParentWithRootPointer() {
JsonPointer parent = JsonPointer.fromURI(URI.create("yaml/valid/refs/Circular.yaml#"));
JsonPointer child = JsonPointer.fromURI(URI.create("yaml/valid/refs/Circular.yaml#/properties/parent"));
assertTrue(parent.isParent(child));
assertFalse(child.isParent(parent));
}
use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testNullQuerying.
@Test
public void testNullQuerying() {
JsonPointer pointer = JsonPointer.from("/hello/world");
assertNull(pointer.queryJson(null));
}
Aggregations