List of usage examples for com.fasterxml.jackson.databind.node TextNode TextNode
public TextNode(String paramString)
From source file:com.aol.one.patch.AddOperationTest.java
@Test public void testCreation() throws PatchException { AddOperation op = new AddOperation("/foo/bar/zoo", new TextNode("fooValue")); Assert.assertEquals(Operation.ADD, op.op); List<String> pathTokens = op.getPathTokens(); Assert.assertEquals(3, pathTokens.size()); Assert.assertEquals("foo", pathTokens.get(0)); Assert.assertEquals("zoo", pathTokens.get(2)); Assert.assertEquals(new TextNode("fooValue"), op.value); }
From source file:com.aol.one.patch.ReplaceOperationTest.java
@Test public void testCreation() throws PatchException { TextNode value = new TextNode("fooValue"); String path = "/foo/bar/zoo"; ReplaceOperation op = new ReplaceOperation(path, value); Assert.assertEquals(Operation.REPLACE, op.op); List<String> pathTokens = op.getPathTokens(); assertThat(pathTokens.size(), is(3)); assertThat(pathTokens.get(0), is("foo")); assertThat(pathTokens.get(1), is("bar")); assertThat(pathTokens.get(2), is("zoo")); assertTrue(path.equals(op.getPath())); assertTrue(value == op.getValue());//from ww w. j a v a2s . c o m }
From source file:com.aol.one.patch.DefaultPatcherPatchableListTest.java
@Test(expected = IndexOutOfBoundsException.class) public void testPatchableAddValueOutOfBounds() throws PatchException { PatchOperation operation = new AddOperation("/1", new TextNode("100")); Patcher patcher = PatcherFactory.getDefaultPatcher(); PatchableList list = spy(patchableList); patcher.patch(list, operation);/*from w w w. j a va 2s. com*/ }
From source file:com.aol.one.patch.DefaultPatcherPatchableMapTest.java
@Test public void testPatchableAddValue() throws PatchException { PatchOperation operation = new AddOperation("/addedValue", new TextNode("100")); Patcher patcher = PatcherFactory.getDefaultPatcher(); assertThat(patchableMap.get("addedValue"), nullValue()); patcher.patch(patchableMap, operation); assertThat(patchableMap.get("addedValue"), is("100")); }
From source file:org.jsonbuilder.implementations.jackson.JacksonStringNode.java
public JacksonStringNode(String value) { this.value = new TextNode(value); }
From source file:com.turn.shapeshifter.transformers.DateTimeTransformerTest.java
@Test public void testSerializeAndParse() { DateTimeTransformer transformer = new DateTimeTransformer(); long tooLongAgo = (Long) transformer.parse(new TextNode("1981-10-17T21:00:00.000-02:00")); Assert.assertEquals("1981-10-17T23:00:00.000Z", transformer.serialize(new Long(tooLongAgo)).asText()); }
From source file:com.aol.one.patch.DefaultPatcherPatchableListTest.java
@Test public void testPatchableAddValue() throws PatchException { PatchOperation operation = new AddOperation("/0", new TextNode("100")); Patcher patcher = PatcherFactory.getDefaultPatcher(); PatchableList list = spy(new PatchableList()); patcher.patch(list, operation);/* ww w .j a va 2 s . com*/ verify(list).add(0, "100"); }
From source file:models.nodes.Value.java
public Promise<JsonNode> toJSON() { JsonNode node = new TextNode(this.name); return Promise.pure(node); }
From source file:com.mapr.synth.samplers.AddressSampler.java
@Override public JsonNode sample() { return new TextNode(number.sample().asInt() + " " + street.sample().asText()); }
From source file:com.aol.one.patch.DefaultPatcherPatchableMapTest.java
@Test public void testPatchableChildAddValue() throws PatchException { PatchOperation operation = new AddOperation("/child/childAddedValue", new TextNode("100")); Patcher patcher = PatcherFactory.getDefaultPatcher(); assertThat(patchableMap.get("childAddedValue"), nullValue()); patcher.patch(patchableMap, operation); assertThat(patchableMap.get("childAddedValue"), is("100")); }