@Test public void testAccept() throws Exception { final Unit[] children = new Unit[5]; Arrays.setAll(children, (i) -> mock(Unit.class)); final U unit = this.factory.apply(children); final UnitVisitor visitor = mock(UnitVisitor.class); unit.accept(visitor); verifyVisit(unit, visitor); for (final Unit child : children) { verify(child).accept(eq(visitor)); } verifyNoMoreInteractions(children); verifyNoMoreInteractions(visitor); }
public void accept(UnitVisitor visitor) { for (Unit child : children) { child.accept(visitor); } }
Unit { public void accept(UnitVisitor visitor) { for (Unit child : children) { child.accept(visitor); } } }
Unit { public void accept(UnitVisitor visitor) { for (Unit child : children) { child.accept(visitor); } } Unit(Unit... children); }
Unit { public void accept(UnitVisitor visitor) { for (Unit child : children) { child.accept(visitor); } } Unit(Unit... children); void accept(UnitVisitor visitor); }
Unit { public void accept(UnitVisitor visitor) { for (Unit child : children) { child.accept(visitor); } } Unit(Unit... children); void accept(UnitVisitor visitor);  }