### Question:
XWikiAttachmentArchive implements Cloneable { public Version[] getVersions() { final Archive rcsArchive = getRCSArchive(); Version[] versions; if (rcsArchive != null) { final Node[] nodes = rcsArchive.changeLog(); versions = new Version[nodes.length]; for (int i = 0; i < nodes.length; i++) { versions[i] = nodes[i].getVersion(); } } else { versions = new Version[] { this.attachment.getRCSVersion() }; } return versions; }  long getId(); void setId(final long id); @Override Object clone(); @Deprecated Archive getRCSArchive(); @Deprecated void setRCSArchive(final Archive archive); String getArchiveAsString(); String getArchiveAsString(final XWikiContext context); byte[] getArchive(); byte[] getArchive(final XWikiContext context); void setArchive(final byte[] data); void setArchive(final String data); @Deprecated void updateArchive(final byte[] data, final XWikiContext context); void updateArchive(final XWikiContext context); XWikiAttachment getAttachment(); void setAttachment(final XWikiAttachment attachment); Version[] getVersions(); XWikiAttachment getRevision(final XWikiAttachment attachment, final String rev, final XWikiContext context);  }### Answer:
@Test public void getVersionsWhenThereIsNoHistory() { Version version = new Version(3, 4); when(attachment.getRCSVersion()).thenReturn(version); assertArrayEquals(new Version[] {version}, archive.getVersions()); }
@Test public void getVersions() throws Exception { Archive rcsArchive = new Archive(new Object[] {"line"}, "file.txt", "5.2"); rcsArchive.addRevision(new Object[] {"line modified"}, ""); archive.setRCSArchive(rcsArchive); assertArrayEquals(new Version[] {new Version(5, 2), new Version(5, 3)}, archive.getVersions()); }