@Test public void testEqualsDifferentChildren() { final AbstractParentStructure other = new ConcreteStructure(name, level); other.addChildMember(mock(StructureMember.class)); assertThat(other).isNotEqualTo(list); assertThat(list).isNotEqualTo(other); }
public void addChildMember(final StructureMember child) { if (child == null) { throw new IllegalArgumentException("Child cannot be null."); } getChildMembers().add(child); }
AbstractParentStructure implements HierarchicalStructureMember { public void addChildMember(final StructureMember child) { if (child == null) { throw new IllegalArgumentException("Child cannot be null."); } getChildMembers().add(child); } }
AbstractParentStructure implements HierarchicalStructureMember { public void addChildMember(final StructureMember child) { if (child == null) { throw new IllegalArgumentException("Child cannot be null."); } getChildMembers().add(child); } AbstractParentStructure(final String name, final int level); }
AbstractParentStructure implements HierarchicalStructureMember { public void addChildMember(final StructureMember child) { if (child == null) { throw new IllegalArgumentException("Child cannot be null."); } getChildMembers().add(child); } AbstractParentStructure(final String name, final int level); void addChildMember(final StructureMember child); @Override boolean equals(final Object obj); @SuppressWarnings("unchecked") T getChildMember(final int index); int getChildMemberCount(); @Override int getLevel(); @Override String getName(); @Override int hashCode(); @Override String toString(); }
AbstractParentStructure implements HierarchicalStructureMember { public void addChildMember(final StructureMember child) { if (child == null) { throw new IllegalArgumentException("Child cannot be null."); } getChildMembers().add(child); } AbstractParentStructure(final String name, final int level); void addChildMember(final StructureMember child); @Override boolean equals(final Object obj); @SuppressWarnings("unchecked") T getChildMember(final int index); int getChildMemberCount(); @Override int getLevel(); @Override String getName(); @Override int hashCode(); @Override String toString();  }