Michael Hanl | e56bb89 | 2016-05-25 17:34:41 +0200 | [diff] [blame^] | 1 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| 2 | import de.ids_mannheim.korap.resource.rewrite.KoralNode; |
| 3 | import de.ids_mannheim.korap.utils.JsonUtils; |
| 4 | import org.junit.Test; |
| 5 | |
| 6 | /** |
| 7 | * @author hanl |
| 8 | * @date 21/10/2015 |
| 9 | */ |
| 10 | public 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 | } |