### Question:
Decision extends NodeBase { @Override public void addParent(final NodeBase parent) { Preconditions.checkState(this.parent == null, "Decision nodes cannot have multiple parents."); this.parent = parent; this.parent.addChild(this); } Decision(final String name); NodeBase getParent(); @Override void addParent(final NodeBase parent); @Override void addParentWithCondition(final Decision parent, final Condition condition); @Override void addParentDefaultConditional(final Decision parent); @Override void removeParent(final NodeBase parent); @Override void clearParents(); @Override List<NodeBase> getChildren(); List<DagNodeWithCondition> getChildrenWithConditions(); NodeBase getDefaultChild();  }### Answer:
@Test public void testAddParentWhenItAlreadyExistsThrows() { final NodeBase parent1 = new ExplicitNode("parent1", null); final NodeBase parent2 = new ExplicitNode("parent2", null); final Decision instance = getInstance("instance"); instance.addParent(parent1); expectedException.expect(IllegalStateException.class); instance.addParent(parent2); }