NumericVersion implements Version, Comparable<NumericVersion> { @Override public boolean isGreaterThan(Version version) { if (version instanceof NullVersion) { return true; } return compareTo((NumericVersion) version) > 0; } NumericVersion(int major, int minor, int micro); @Override int compareTo(NumericVersion other); @Override String toString(); @Override boolean isGreaterThan(Version version); @Override boolean isEqualTo(Version version); @Override String asString();  }
@Test public void isGreaterThanVersionWithSmallerMajor() throws Exception { NumericVersion latestVersion = new NumericVersion(5, 2, 1); assertThat(latestVersion, is(NumericVersionMatchers.isGreaterThan(currentVersion))); }
@Test public void isGreaterThanVersionWithSmallerMinor() throws Exception { NumericVersion latestVersion = new NumericVersion(4, 3, 1); assertThat(latestVersion, is(NumericVersionMatchers.isGreaterThan(currentVersion))); }
@Test public void isGreaterThanVersionWithSmallerMicro() throws Exception { NumericVersion latestVersion = new NumericVersion(4, 2, 2); assertThat(latestVersion, is(NumericVersionMatchers.isGreaterThan(currentVersion))); }