### Question:
NodeBuilderBaseImpl { public B withParent(final Node parent) { checkNoDuplicateParent(parent); parents.add(parent); return ensureRuntimeSelfReference(); } NodeBuilderBaseImpl();   NodeBuilderBaseImpl(final Node node); B withErrorHandler(final ErrorHandler errorHandler); B withoutErrorHandler(); B withName(final String name); B withCredential(final Credential credential); B withoutCredential(final Credential credential); B clearCredentials(); B withRetryMax(final Integer retryMax); B withRetryInterval(final Integer retryInterval); B withRetryPolicy(final String retryPolicy); B withParent(final Node parent); B withParentWithCondition(final Node parent, final String condition); B withParentDefaultConditional(final Node parent); B withoutParent(final Node parent); B clearParents();  }### Answer:
@Test public void testAddParents() { final N parent1 = Mockito.spy(getBuilderInstance().build()); final N parent2 = Mockito.spy(getBuilderInstance().build()); final B builder = getBuilderInstance(); builder.withParent(parent1) .withParent(parent2); final N child = builder.build(); assertEquals(Arrays.asList(parent1, parent2), child.getAllParents()); Mockito.verify(parent1).addChild(child); Mockito.verify(parent2).addChild(child); Mockito.verifyNoMoreInteractions(parent1); Mockito.verifyNoMoreInteractions(parent2); }
@Test public void testAddingDuplicateParentBothTimesWithoutConditionThrows() { final N parent = getBuilderInstance().build(); final B builder = getBuilderInstance(); builder.withParent(parent); expectedException.expect(IllegalArgumentException.class); builder.withParent(parent); }