blob: 6418ee190ddf87f77451b3c8916a74a14044de48 [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 */
Michael Hanl33829ec2016-05-28 17:03:38 +020010// todo: complete tests
Michael Hanle56bb892016-05-25 17:34:41 +020011public class KoralNodeTest {
12
13 // todo: 21.10.15 --> e.g. injection does not tell you if an entire node was injected, or just a value!
14 @Test
15 public void addToNode () {
16 ObjectNode node = JsonUtils.createObjectNode();
17 KoralNode knode = KoralNode.wrapNode(node);
18 knode.put("value_1", "setting_1");
19
20 System.out.println(knode.rawNode().toString());
21 }
22
23
24 @Test
25 public void removeFromNode () {
26 ObjectNode node = JsonUtils.createObjectNode();
27 node.put("value_1", "setting_1");
28 KoralNode knode = KoralNode.wrapNode(node);
Michael Hanl33829ec2016-05-28 17:03:38 +020029 knode.remove("value_1", null);
Michael Hanle56bb892016-05-25 17:34:41 +020030 System.out.println(knode.rawNode().toString());
31 }
32
33
34 @Test
35 public void replaceObject () {
36 ObjectNode node = JsonUtils.createObjectNode();
37 node.put("value_1", "setting_1");
38 KoralNode knode = KoralNode.wrapNode(node);
Michael Hanl33829ec2016-05-28 17:03:38 +020039 knode.replace("value_1", "settings_2", null);
Michael Hanle56bb892016-05-25 17:34:41 +020040 System.out.println(knode.rawNode().toString());
41 }
42
43
44 // todo: 21.10.15 --> if a node is injected, that node must contain a "rewrites" reference?!
45 @Test
46 public void addNodeToKoral () {
47
48 }
49}