ItemDocumentation extends BaseDocumentation { public ItemDocumentation copyWithDisplayName(String nameToUse) { if(nameToUse.equals(getId())) { return this; } ItemDocumentation copy = new ItemDocumentation(getId()); copy.setDescription(getDescription()); copy.displayName = nameToUse; copy.aliases = this.aliases; copy.tables = this.tables; copy.format = this.format; copy.seeAlso = this.seeAlso; copy.functionNames = this.functionNames; return copy; } ItemDocumentation();  ItemDocumentation(String id); ItemDocumentation copyWithDisplayName(String nameToUse); boolean documents(String id); List<String> getAliases(); String getDisplayName(); void setDisplayName(String displayName); String getFormat(); List<String> getFunctionNames(); List<String> getSeeAlso(); List<Table> getTables(); void setAliases(List<String> aliases); void setFormat(String format); void setFunctionNames(List<String> functionNames); void setSeeAlso(List<String> itemDocumentationIds); void setTables(List<Table> tables); @Override String toString();  }
@Test public void testCopyWithDisplayName() { ItemDocumentation iDoc1 = new ItemDocumentation(); assertNull(iDoc1.getId()); assertNull(iDoc1.getDisplayName()); iDoc1.setId("aaa"); assertEquals("aaa", iDoc1.getDisplayName()); iDoc1.setDisplayName("bbb"); assertEquals("bbb", iDoc1.getDisplayName()); assertEquals("aaa", iDoc1.getId()); List<String> listOfStrings = new ArrayList<String>(); iDoc1.setAliases(listOfStrings); iDoc1.setFunctionNames(listOfStrings); iDoc1.setSeeAlso(listOfStrings); Description description = new Description(); iDoc1.setDescription(description); List<Table> listOfTables = new ArrayList<Table>(); iDoc1.setTables(listOfTables); String format = "fff"; iDoc1.setFormat(format); ItemDocumentation iDoc2 = iDoc1.copyWithDisplayName("ccc"); assertEquals("aaa", iDoc2.getId()); assertEquals("ccc", iDoc2.getDisplayName()); assertSame(listOfStrings,iDoc2.getAliases()); assertSame(listOfStrings,iDoc2.getFunctionNames()); assertSame(listOfStrings,iDoc2.getSeeAlso()); assertSame(description,iDoc2.getDescription()); assertSame(listOfTables,iDoc2.getTables()); assertSame(format,iDoc2.getFormat()); }