BaseCommand { public void setRevision(final Revision revision) { Validate.notNull(revision); this.revision = revision; } BaseCommand(); String getPath(); String getEncodedPath(); void setPath(final String path); Revision getRevision(); void setRevision(final Revision revision); void setPegRevision(final Revision pegRevision); Revision getPegRevision(); boolean hasPegRevision(); long getRevisionNumber(); String getTarget(); String getEncodedTarget(); String getParentPath(); String getPathPart(); DirEntryComparator.SortType getSortType(); void setSortType(final DirEntryComparator.SortType sortType); DirEntrySorter.SortMode getSortMode(); void setSortMode(final DirEntrySorter.SortMode sortMode); void setName(final RepositoryName name); RepositoryName getName(); @Override boolean equals(final Object obj); @Override int hashCode(); String createListUrl(); String createShowFileUrl(); String getPathWithTrailingSlash(); @Override String toString();  }
@Test public void testSetRevision() { final BaseCommand command = new BaseCommand(); try { command.setRevision(null); fail("Should throw IllegalArgumentException"); } catch (IllegalArgumentException e) { } assertEquals(Revision.HEAD, command.getRevision()); assertTrue(command.getRevision().isHeadRevision()); command.setRevision(Revision.parse("2")); assertEquals(Revision.create(2), command.getRevision()); command.setRevision(Revision.parse("Drutten")); assertEquals(Revision.UNDEFINED, command.getRevision()); assertFalse(command.getRevision().isHeadRevision()); command.setRevision(Revision.parse("HEAD")); assertEquals(Revision.HEAD, command.getRevision()); assertTrue(command.getRevision().isHeadRevision()); command.setRevision(Revision.parse("head")); assertEquals(Revision.HEAD, command.getRevision()); assertTrue(command.getRevision().isHeadRevision()); command.setRevision(Revision.parse("HEad")); assertEquals(Revision.HEAD, command.getRevision()); assertTrue(command.getRevision().isHeadRevision()); }