### Question:
AttachmentDiff { @Override public String toString() { StringBuilder buf = new StringBuilder(this.fileName); buf.append(": "); if (this.origVersion != null) { buf.append(this.origVersion); } else { buf.append("()"); } buf.append(" \u21E8 "); if (this.newVersion != null) { buf.append(this.newVersion); } else { buf.append("()"); } return buf.toString(); } @Deprecated  AttachmentDiff(String fileName, String origVersion, String newVersion);  AttachmentDiff(String fileName, Delta.Type type, XWikiAttachment origAttachment,
        XWikiAttachment newAttachment); String getFileName(); void setFileName(String fileName); Delta.Type getType(); XWikiAttachment getOrigAttachment(); XWikiAttachment getNewAttachment(); @Deprecated String getOrigVersion(); @Deprecated void setOrigVersion(String origVersion); @Deprecated String getNewVersion(); @Deprecated void setNewVersion(String newVersion); @Override String toString();  }### Answer:
@Test public void toStringWhenVersionsNotNull() { AttachmentDiff diff = new AttachmentDiff("filename", "1.1", "1.2"); Assert.assertEquals("filename: 1.1 \u21E8 1.2", diff.toString()); }
@Test public void toStringWhenNoOriginalVersion() { AttachmentDiff diff = new AttachmentDiff("filename", null, "1.1"); Assert.assertEquals("filename: () \u21E8 1.1", diff.toString()); }
@Test public void toStringWhenNoNewVersion() { AttachmentDiff diff = new AttachmentDiff("filename", "1.1", null); Assert.assertEquals("filename: 1.1 \u21E8 ()", diff.toString()); }
@Test public void toStringWhenNoVersions() { AttachmentDiff diff = new AttachmentDiff("filename", null, null); Assert.assertEquals("filename: () \u21E8 ()", diff.toString()); }