### Question:
JoiningNodeBase extends NodeBase { @Override public void addParent(final NodeBase parent) { if (parent != null) { parent.addChild(this); } parents.add(parent); } JoiningNodeBase(final String name, final T branching); List<NodeBase> getParents(); @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(); NodeBase getChild();  }### Answer:
@Test public void testJoinAddedAsParentWhenItAlreadyHasAChildThrows() { final J instance = getJoiningInstance("instance"); final NodeBase child1 = new ExplicitNode("child1", null); final NodeBase child2 = new ExplicitNode("child2", null); child1.addParent(instance); expectedException.expect(IllegalStateException.class); child2.addParent(instance); }