use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testBuilding.
@Test
public void testBuilding() {
List<String> keys = new ArrayList<>();
keys.add("hello");
keys.add("world");
JsonPointer pointer = new JsonPointerImpl(URI.create("#"), keys);
assertEquals("/hello/world", pointer.toString());
}
use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testNullQueryingRootPointer.
@Test
public void testNullQueryingRootPointer() {
JsonPointer pointer = JsonPointer.create();
assertNull(pointer.queryJson(null));
}
use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testURIJsonPointerEncodedParsing.
@Test
public void testURIJsonPointerEncodedParsing() {
JsonPointer pointer = JsonPointer.fromURI(URI.create("http://www.example.org#/hell~1o/worl~0d"));
assertEquals("/hell~1o/worl~0d", pointer.toString());
assertEquals(URI.create("http://www.example.org#/hell~1o/worl~0d"), pointer.toURI());
}
use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testRootPointer.
@Test
public void testRootPointer() {
JsonPointer pointer = JsonPointer.create();
JsonArray array = new JsonArray();
JsonObject obj = new JsonObject().put("hello", new JsonObject().put("world", 2).put("worl", "wrong")).put("helo", new JsonObject().put("world", "wrong").put("worl", "wrong"));
array.add(obj);
array.add(new JsonObject().put("hello", new JsonObject().put("world", 1).put("worl", "wrong")).put("helo", new JsonObject().put("world", "wrong").put("worl", "wrong")));
assertEquals(array, pointer.queryJson(array));
assertEquals(obj, pointer.queryJson(obj));
assertEquals("hello", pointer.queryJson("hello"));
}
use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.
the class JsonPointerTest method testURIEncodedParsing.
@Test
public void testURIEncodedParsing() {
JsonPointer pointer = JsonPointer.fromURI(URI.create("http://www.example.org#/hello/world/%5Ea"));
assertEquals("/hello/world/^a", pointer.toString());
assertEquals(URI.create("http://www.example.org#/hello/world/%5Ea"), pointer.toURI());
}
Aggregations