### Question:
IrodsVersion implements Comparable<IrodsVersion> { @Override public int compareTo(final IrodsVersion otherVersion) { if (major < otherVersion.major) { return -1; } else if (major > otherVersion.major) { return 1; } if (minor < otherVersion.minor) { return -1; } else if (minor > otherVersion.minor) { return 1; } if (patch < otherVersion.patch) { return -1; } else if (patch > otherVersion.patch) { return 1; } return 0; } IrodsVersion(final String reportedVersion); String getPatchAsString(); @Override String toString(); String getOrigVersion(); String getMajorAsString(); String getMinorAsString(); int getMajor(); int getMinor(); int getPatch(); boolean hasVersionOfAtLeast(final String versionString); @Override int compareTo(final IrodsVersion otherVersion); static final String RODS_PREFIX; }### Answer:
@Test public void testCompare418to419ExpectNeg1() { IrodsVersion version = new IrodsVersion("rods4.1.8"); IrodsVersion version419 = new IrodsVersion("rods4.1.9"); int actual = version.compareTo(version419); Assert.assertEquals("418 should be lt 419", -1, actual); }
@Test public void testCompare419to418Expect1() { IrodsVersion version = new IrodsVersion("rods4.1.8"); IrodsVersion version419 = new IrodsVersion("rods4.1.9"); int actual = version419.compareTo(version); Assert.assertEquals("418 should be lt 419", 1, actual); }
@Test public void testCompare31to418Expect1() { IrodsVersion version = new IrodsVersion("rods3.1"); IrodsVersion version419 = new IrodsVersion("rods4.1.9"); int actual = version419.compareTo(version); Assert.assertEquals("31 should be lt 419", 1, actual); }
@Test public void testCompare419to419Expect0() { IrodsVersion version = new IrodsVersion("rods4.1.9"); IrodsVersion version419 = new IrodsVersion("rods4.1.9"); int actual = version419.compareTo(version); Assert.assertEquals("419 should be eq 419", 0, actual); }