blob: d8f5ab18cb756239e664ca104e9dd0016ef1349e [file] [log] [blame]
Michael Hanle56bb892016-05-25 17:34:41 +02001import com.fasterxml.jackson.databind.node.ObjectNode;
2import de.ids_mannheim.korap.resource.rewrite.KoralNode;
3import de.ids_mannheim.korap.utils.JsonUtils;
4import org.junit.Test;
5
6/**
7 * @author hanl
8 * @date 21/10/2015
9 */
10public class KoralNodeTest {
11
12 // todo: 21.10.15 --> e.g. injection does not tell you if an entire node was injected, or just a value!
13 @Test
14 public void addToNode () {
15 ObjectNode node = JsonUtils.createObjectNode();
16 KoralNode knode = KoralNode.wrapNode(node);
17 knode.put("value_1", "setting_1");
18
19 System.out.println(knode.rawNode().toString());
20 }
21
22
23 @Test
24 public void removeFromNode () {
25 ObjectNode node = JsonUtils.createObjectNode();
26 node.put("value_1", "setting_1");
27 KoralNode knode = KoralNode.wrapNode(node);
28 knode.remove("value_1");
29 System.out.println(knode.rawNode().toString());
30 }
31
32
33 @Test
34 public void replaceObject () {
35 ObjectNode node = JsonUtils.createObjectNode();
36 node.put("value_1", "setting_1");
37 KoralNode knode = KoralNode.wrapNode(node);
38 knode.replace("value_1", "settings_2");
39 System.out.println(knode.rawNode().toString());
40 }
41
42
43 // todo: 21.10.15 --> if a node is injected, that node must contain a "rewrites" reference?!
44 @Test
45 public void addNodeToKoral () {
46
47 }
48}