RuleTree { public RuleTreeNode getRoot() { return root; } RuleTree();  RuleTree(final RuleTree other); RuleTreeNode getRoot(); @JsonSetter("rules") void setRoot(RuleTreeNode root);  }
@Test public void Deserialization_MockTree_ShouldDeserialize() throws JsonMappingException, JsonProcessingException { final String str = "{\n" + " \"collection\": \"circuit_rules\",\n" + " \"rules\": {\n" + " \"function\": \"AND\",\n" + " \"rules\": [\n" + " {\n" + " \"function\": \"AND\",\n" + " \"rules\": [\n" + " \"[0] EQUALS L1\",\n" + " \"[1] EQUALS Ascar\",\n" + " \"[3] EQUALS Bscar\"\n" + " ]\n" + " },\n" + " {\n" + " \"function\": \"AND\",\n" + " \"rules\": [\n" + " \"[5] EQUALS Cscar\",\n" + " \"[7] EQUALS Dscar\",\n" + " \"[9] EQUALS Escar\"\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + "}"; ObjectMapper mapper = new ObjectMapper(); RuleTree tree = mapper.readValue(str, RuleTree.class); assert (tree.getRoot() instanceof ParentRuleTreeNode); }