@Test(expected=IllegalArgumentException.class) public void testAddChildren_WithSameLabelName(){ labelNode.addChildNode(new LabelNodeImpl(LABEL_NODE_NAME)); }
public boolean addChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (node.getName().equals(name)) { throw new IllegalArgumentException("The child label node can not have same name as parent."); } if (!childrenNodes.contains(node)) { ((LabelNodeImpl) node).setParent(this); } return childrenNodes.add(node); }
LabelNodeImpl implements LabelNode, Serializable { public boolean addChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (node.getName().equals(name)) { throw new IllegalArgumentException("The child label node can not have same name as parent."); } if (!childrenNodes.contains(node)) { ((LabelNodeImpl) node).setParent(this); } return childrenNodes.add(node); } }
LabelNodeImpl implements LabelNode, Serializable { public boolean addChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (node.getName().equals(name)) { throw new IllegalArgumentException("The child label node can not have same name as parent."); } if (!childrenNodes.contains(node)) { ((LabelNodeImpl) node).setParent(this); } return childrenNodes.add(node); } LabelNodeImpl(String name); @SuppressWarnings("unused") private  LabelNodeImpl(); }
LabelNodeImpl implements LabelNode, Serializable { public boolean addChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (node.getName().equals(name)) { throw new IllegalArgumentException("The child label node can not have same name as parent."); } if (!childrenNodes.contains(node)) { ((LabelNodeImpl) node).setParent(this); } return childrenNodes.add(node); } LabelNodeImpl(String name); @SuppressWarnings("unused") private  LabelNodeImpl(); boolean addChildNode(LabelNode node); boolean removeChildNode(LabelNode node); Set<String> getChildrenLabels(); Set<String> getDescendantLabels(); Set<LabelNode> getChildren(); String getName(); LabelNode getParent(); boolean hasChildren(); boolean hasParent(); @Override int hashCode(); @Override boolean equals(Object obj); }
LabelNodeImpl implements LabelNode, Serializable { public boolean addChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (node.getName().equals(name)) { throw new IllegalArgumentException("The child label node can not have same name as parent."); } if (!childrenNodes.contains(node)) { ((LabelNodeImpl) node).setParent(this); } return childrenNodes.add(node); } LabelNodeImpl(String name); @SuppressWarnings("unused") private  LabelNodeImpl(); boolean addChildNode(LabelNode node); boolean removeChildNode(LabelNode node); Set<String> getChildrenLabels(); Set<String> getDescendantLabels(); Set<LabelNode> getChildren(); String getName(); LabelNode getParent(); boolean hasChildren(); boolean hasParent(); @Override int hashCode(); @Override boolean equals(Object obj);  }