### Question:
NodeBuilderBaseImpl { public B withParentWithCondition(final Node parent, final String condition) { checkNoDuplicateParent(parent); parentsWithConditions.add(new Node.NodeWithCondition(parent, Condition.actualCondition(condition))); 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 testWithConditionalParents() { final String condition1 = "condition1"; final String condition2 = "condition2"; final N parent1 = Mockito.spy(getBuilderInstance().build()); final N parent2 = Mockito.spy(getBuilderInstance().build()); final B builder = getBuilderInstance(); builder.withParentWithCondition(parent1, condition1) .withParentWithCondition(parent2, condition2); final N child = builder.build(); final List<Node.NodeWithCondition> nodesWithConditions = child.getParentsWithConditions(); assertEquals(parent1, nodesWithConditions.get(0).getNode()); assertEquals(Condition.actualCondition(condition1), nodesWithConditions.get(0).getCondition()); assertEquals(parent2, nodesWithConditions.get(1).getNode()); assertEquals(Condition.actualCondition(condition2), nodesWithConditions.get(1).getCondition()); Mockito.verify(parent1).addChildWithCondition(child, condition1); Mockito.verify(parent2).addChildWithCondition(child, condition2); Mockito.verifyNoMoreInteractions(parent1); Mockito.verifyNoMoreInteractions(parent2); }
@Test public void testAddingDuplicateParentBothTimesWithConditionThrows() { final N parent = getBuilderInstance().build(); final B builder = getBuilderInstance(); builder.withParentWithCondition(parent, "condition1"); expectedException.expect(IllegalArgumentException.class); builder.withParentWithCondition(parent, "condition2"); }