Search in sources :

Example 1 with JsonPointer

use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.

the class JsonPointerTest method testURIParsing.

@Test
public void testURIParsing() {
    JsonPointer pointer = JsonPointer.fromURI(URI.create("http://www.example.org#/hello/world"));
    assertEquals("/hello/world", pointer.toString());
    assertEquals(URI.create("http://www.example.org#/hello/world"), pointer.toURI());
}
Also used : JsonPointer(io.vertx.core.json.pointer.JsonPointer) Test(org.junit.Test)

Example 2 with JsonPointer

use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.

the class JsonPointerTest method testEmptyBuilding.

@Test
public void testEmptyBuilding() {
    JsonPointer pointer = JsonPointer.create();
    assertEquals("", pointer.toString());
    assertEquals(URI.create("#"), pointer.toURI());
}
Also used : JsonPointer(io.vertx.core.json.pointer.JsonPointer) Test(org.junit.Test)

Example 3 with JsonPointer

use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.

the class JsonPointerTest method testRootPointerWrite.

@Test
public void testRootPointerWrite() {
    JsonPointer pointer = JsonPointer.create();
    JsonObject obj = new JsonObject();
    JsonArray arr = new JsonArray();
    assertSame(arr, pointer.writeJson(obj, arr, false));
}
Also used : JsonArray(io.vertx.core.json.JsonArray) JsonObject(io.vertx.core.json.JsonObject) JsonPointer(io.vertx.core.json.pointer.JsonPointer) Test(org.junit.Test)

Example 4 with JsonPointer

use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.

the class JsonPointerTest method testURIBuilding.

@Test
public void testURIBuilding() {
    JsonPointer pointer = JsonPointer.create().append("hello").append("world");
    assertEquals(URI.create("#/hello/world"), pointer.toURI());
}
Also used : JsonPointer(io.vertx.core.json.pointer.JsonPointer) Test(org.junit.Test)

Example 5 with JsonPointer

use of io.vertx.core.json.pointer.JsonPointer in project vert.x by eclipse.

the class JsonPointerTest method testIsParentDifferentURI.

@Test
public void testIsParentDifferentURI() {
    JsonPointer parent = JsonPointer.fromURI(URI.create("yaml/valid/refs/Circular.yaml#/properties"));
    JsonPointer child = JsonPointer.fromURI(URI.create("json/valid/refs/Circular.yaml#/properties/parent"));
    assertFalse(parent.isParent(child));
    assertFalse(child.isParent(parent));
}
Also used : JsonPointer(io.vertx.core.json.pointer.JsonPointer) Test(org.junit.Test)

Aggregations

JsonPointer (io.vertx.core.json.pointer.JsonPointer)24 Test (org.junit.Test)23 JsonObject (io.vertx.core.json.JsonObject)8 JsonArray (io.vertx.core.json.JsonArray)5 ArrayList (java.util.ArrayList)1