@Test void compareTo() { assertEquals(0, new DefaultVersion("1.1").compareTo(new DefaultVersion("1.1"))); assertEquals(0, new DefaultVersion("1.1").compareTo(new DefaultVersion("1.1.0"))); assertEquals(0, new DefaultVersion("1.1").compareTo(new DefaultVersion("1.1."))); assertEquals(0, new DefaultVersion("1.1").compareTo(new DefaultVersion("1.1ga"))); assertEquals(0, new DefaultVersion("1.1").compareTo(new DefaultVersion("1.1final"))); assertTrue(new DefaultVersion("1.2").compareTo(new DefaultVersion("1.1")) > 0); assertTrue(new DefaultVersion("1.1").compareTo(new DefaultVersion("1.2")) < 0); assertTrue(new DefaultVersion("1.1").compareTo(new DefaultVersion("1.1w")) < 0); assertTrue(new DefaultVersion("1.1").compareTo(new DefaultVersion("1.1-milestone-1")) > 0); assertTrue(new DefaultVersion("1.1.1").compareTo(new DefaultVersion("1.1-milestone-1")) > 0); }
@Override public int compareTo(Version version) { if (version == this) { return 0; } if (version instanceof DefaultVersion) { return compareTo((DefaultVersion) version); } else { return compareTo(new DefaultVersion(version.getValue())); } }
DefaultVersion implements Version { @Override public int compareTo(Version version) { if (version == this) { return 0; } if (version instanceof DefaultVersion) { return compareTo((DefaultVersion) version); } else { return compareTo(new DefaultVersion(version.getValue())); } } }
DefaultVersion implements Version { @Override public int compareTo(Version version) { if (version == this) { return 0; } if (version instanceof DefaultVersion) { return compareTo((DefaultVersion) version); } else { return compareTo(new DefaultVersion(version.getValue())); } } DefaultVersion(String rawVersion);  DefaultVersion(Version version); }
DefaultVersion implements Version { @Override public int compareTo(Version version) { if (version == this) { return 0; } if (version instanceof DefaultVersion) { return compareTo((DefaultVersion) version); } else { return compareTo(new DefaultVersion(version.getValue())); } } DefaultVersion(String rawVersion);  DefaultVersion(Version version); @Override Type getType(); @Override String getValue(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); boolean equals(DefaultVersion version); @Override int compareTo(Version version); int compareTo(String version); int compareTo(DefaultVersion version); }
DefaultVersion implements Version { @Override public int compareTo(Version version) { if (version == this) { return 0; } if (version instanceof DefaultVersion) { return compareTo((DefaultVersion) version); } else { return compareTo(new DefaultVersion(version.getValue())); } } DefaultVersion(String rawVersion);  DefaultVersion(Version version); @Override Type getType(); @Override String getValue(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); boolean equals(DefaultVersion version); @Override int compareTo(Version version); int compareTo(String version); int compareTo(DefaultVersion version);  }