### Question:
SemanticVersion implements Comparable<SemanticVersion> { @Override public int compareTo(@NotNull SemanticVersion o) { if (o == null) { return 1; } int majorDiff = this.major - o.major; if (majorDiff != 0) { return majorDiff; } int minorDiff = this.minor - o.minor; if (minorDiff != 0) { return minorDiff; } return this.revision - o.revision; } SemanticVersion(int major, int minor);  SemanticVersion(int major, int minor, int revision);  SemanticVersion(String fullVersion); int getMajor(); int getMinor(); int getRevision(); Compatibility getCompatibilityWith(String minimumVersion); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override int compareTo(@NotNull SemanticVersion o);  }### Answer:
@Test public void whenVersionsSame_compareReportsZero() { SemanticVersion first = new SemanticVersion("5.6.7"); SemanticVersion second = new SemanticVersion("5.6.7"); assertThat(first.compareTo(second), equalTo(0)); }
@Test public void whenVersionsSameWithDefaultRevisionZero_compareReportsZero() { SemanticVersion first = new SemanticVersion("5.6"); SemanticVersion second = new SemanticVersion("5.6.0"); assertThat(first.compareTo(second), equalTo(0)); }
@Test public void whenMajorVersionIsLower_compareReportsLower() { SemanticVersion first = new SemanticVersion("5.6.7"); SemanticVersion second = new SemanticVersion("10.3.4"); assertThat(first.compareTo(second), lessThan(0)); }
@Test public void whenMajorVersionIsGreater_compareReportsGreater() { SemanticVersion first = new SemanticVersion("5.6.7"); SemanticVersion second = new SemanticVersion("2.8.9"); assertThat(first.compareTo(second), greaterThan(0)); }
@Test public void whenMinorVersionIsLower_compareReportsLower() { SemanticVersion first = new SemanticVersion("5.6.7"); SemanticVersion second = new SemanticVersion("5.7.2"); assertThat(first.compareTo(second), lessThan(0)); }
@Test public void whenMinorVersionIsGreater_compareReportsGreater() { SemanticVersion first = new SemanticVersion("5.6.7"); SemanticVersion second = new SemanticVersion("5.5.9"); assertThat(first.compareTo(second), greaterThan(0)); }
@Test public void whenRevisionVersionIsLower_compareReportsLower() { SemanticVersion first = new SemanticVersion("5.6.7"); SemanticVersion second = new SemanticVersion("5.6.8"); assertThat(first.compareTo(second), lessThan(0)); }
@Test public void whenRevisionVersionIsGreater_compareReportsGreater() { SemanticVersion first = new SemanticVersion("5.6.7"); SemanticVersion second = new SemanticVersion("5.6.6"); assertThat(first.compareTo(second), greaterThan(0)); }