@Test public void testGetChildMember() { final StructureMember first = mock(StructureMember.class); final StructureMember second = mock(StructureMember.class); list.addChildMember(first); list.addChildMember(second); assertThat(list.getChildMemberCount()).isEqualTo(2); assertThat(list.<StructureMember> getChildMember(0)).isEqualTo(first); assertThat(list.<StructureMember> getChildMember(1)).isEqualTo(second); }
@SuppressWarnings("unchecked") public <T extends StructureMember> T getChildMember(final int index) { return (T) getChildMembers().get(index); }
AbstractParentStructure implements HierarchicalStructureMember { @SuppressWarnings("unchecked") public <T extends StructureMember> T getChildMember(final int index) { return (T) getChildMembers().get(index); } }
AbstractParentStructure implements HierarchicalStructureMember { @SuppressWarnings("unchecked") public <T extends StructureMember> T getChildMember(final int index) { return (T) getChildMembers().get(index); } AbstractParentStructure(final String name, final int level); }
AbstractParentStructure implements HierarchicalStructureMember { @SuppressWarnings("unchecked") public <T extends StructureMember> T getChildMember(final int index) { return (T) getChildMembers().get(index); } 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 { @SuppressWarnings("unchecked") public <T extends StructureMember> T getChildMember(final int index) { return (T) getChildMembers().get(index); } 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();  }