FunctionDocumentation extends BaseDocumentation { public boolean add(ItemDocumentation itemDocumentation) { initFields(); if (!isGroupMember(itemDocumentation)) { this.fields.add(itemDocumentation); return true; } return false; } FunctionDocumentation(); boolean add(ItemDocumentation itemDocumentation); boolean isGroupMember(ItemDocumentation itemDocumentation); String getDisplayName(); SortedSet<ItemDocumentation> getFields(); boolean hasDisplayName(); void setDisplayName(String displayName); void setFields(SortedSet<ItemDocumentation> fields); List<GroupDocumentation> getGroups(); void setGroups(List<GroupDocumentation> groups); @Override String toString();  }
@Test public void testAdd() { FunctionDocumentation fd = new FunctionDocumentation(); fd.setGroups(listOfGroups); assertFalse(fd.add(iDoc2)); assertTrue(fd.add(iDoc1)); assertEquals(1, fd.getFields().size()); assertTrue(fd.getFields().contains(iDoc1)); }