HaloServerVersion { @Api(1.2) public boolean isOutdated(@NonNull String version) { AssertionUtils.notNull(version, "version == null"); return new Version(version).compareTo(new Version(mMinHaloVersion)) < 0; } HaloServerVersion();  HaloServerVersion(@Nullable String changelogUrl, @Nullable String minAndroidVersion); @Api(1.2) @Nullable String getHaloVersion(); @Api(1.2) @Nullable String getChangeLogUrl(); @Api(1.2) boolean isOutdated(@NonNull String version); @Override boolean equals(Object o); @Override int hashCode(); static final int VALID; static final int OUTDATED; static final int NOT_CHECKED; }
@Test public void thatVersionIsOutdated() { HaloServerVersion version = new HaloServerVersion("changelog", "1.0"); HaloServerVersion newVersion = new HaloServerVersion("changelog", "1.1"); assertThat(version.isOutdated("1.1")).isFalse(); assertThat(version.isOutdated("1.0")).isFalse(); assertThat(version.isOutdated("1.0.1")).isFalse(); assertThat(version.isOutdated("0.9")).isTrue(); assertThat(version.isOutdated("0")).isTrue(); assertThat(version.isOutdated("0.5.3")).isTrue(); assertThat(newVersion.isOutdated("1")).isTrue(); }