### Question:
Version implements Serializable, Comparable<Version> { @Override public int compareTo(Version v) { if (v == null) { throw new IllegalArgumentException("Unable to compare to null version"); } int i = major.compareTo(v.major); if (i > 0) { return 1; } else if (i < 0) { return -1; } else { int j = minor.compareTo(v.minor); if (j > 0) { return 1; } else if (j < 0) { return -1; } else { int k = patch.compareTo(v.patch); if (k > 0) { return 1; } else if (k < 0) { return -1; } else { return 0; } } } } Version(String version);  Version(Integer major, Integer minor, Integer patch); Integer major(); Integer minor(); Integer patch(); @Override int compareTo(Version v); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testCompare() { Version v = new Version(1,2,3); assertEquals(1, v.compareTo(new Version(0,2,3))); assertEquals(1, v.compareTo(new Version(1,0,3))); assertEquals(1, v.compareTo(new Version(1,2,0))); assertEquals(-1, v.compareTo(new Version(2,2,3))); assertEquals(-1, v.compareTo(new Version(1,3,3))); assertEquals(-1, v.compareTo(new Version(1,2,4))); assertEquals(0, v.compareTo(new Version(1,2,3))); }