@Test public void testCompareTo() { assertTrue(version("8.0.0").compareTo(version("8.0.0"))); assertTrue(version("8.0.0").compareTo(version("8.0.x"))); assertTrue(version("8.0.0").compareTo(version("8.x.0"))); assertTrue(version("8.0.0").compareTo(version("8.x.x"))); assertTrue(version("8.0.x").compareTo(version("8.0.0"))); assertTrue(version("8.x.0").compareTo(version("8.0.0"))); assertTrue(version("8.x.x").compareTo(version("8.0.0"))); assertFalse(version("8.0.0").compareTo(version("7.0.0"))); assertFalse(version("8.0.0").compareTo(version("8.1.0"))); assertFalse(version("8.0.0").compareTo(version("8.x.1"))); assertFalse(version("8.0.0").compareTo(version("9.0.0"))); assertFalse(version("7.0.0").compareTo(version("8.0.0"))); assertFalse(version("8.1.0").compareTo(version("8.0.0"))); assertFalse(version("8.x.1").compareTo(version("8.0.0"))); assertFalse(version("9.0.0").compareTo(version("8.0.0"))); assertTrue(version("9.1.1").compareTo(version("9.1.x"))); }
@Override public boolean compareTo(TeiidVersion otherVersion) { String entryMajor = otherVersion.getMajor(); if (! getMajor().equals(entryMajor) && ! getMajor().equals(WILDCARD) && ! entryMajor.equals(WILDCARD)) return false; String entryMinor = otherVersion.getMinor(); if (! getMinor().equals(entryMinor) && ! getMinor().equals(WILDCARD) && ! entryMinor.equals(WILDCARD)) return false; String entryMicro = otherVersion.getMicro(); if (! getMicro().equals(entryMicro) && ! getMicro().equals(WILDCARD) && ! entryMicro.equals(WILDCARD)) return false; return true; }
DefaultTeiidVersion implements TeiidVersion { @Override public boolean compareTo(TeiidVersion otherVersion) { String entryMajor = otherVersion.getMajor(); if (! getMajor().equals(entryMajor) && ! getMajor().equals(WILDCARD) && ! entryMajor.equals(WILDCARD)) return false; String entryMinor = otherVersion.getMinor(); if (! getMinor().equals(entryMinor) && ! getMinor().equals(WILDCARD) && ! entryMinor.equals(WILDCARD)) return false; String entryMicro = otherVersion.getMicro(); if (! getMicro().equals(entryMicro) && ! getMicro().equals(WILDCARD) && ! entryMicro.equals(WILDCARD)) return false; return true; } }
DefaultTeiidVersion implements TeiidVersion { @Override public boolean compareTo(TeiidVersion otherVersion) { String entryMajor = otherVersion.getMajor(); if (! getMajor().equals(entryMajor) && ! getMajor().equals(WILDCARD) && ! entryMajor.equals(WILDCARD)) return false; String entryMinor = otherVersion.getMinor(); if (! getMinor().equals(entryMinor) && ! getMinor().equals(WILDCARD) && ! entryMinor.equals(WILDCARD)) return false; String entryMicro = otherVersion.getMicro(); if (! getMicro().equals(entryMicro) && ! getMicro().equals(WILDCARD) && ! entryMicro.equals(WILDCARD)) return false; return true; } DefaultTeiidVersion(String major, String minor, String micro);  DefaultTeiidVersion(String versionString); }
DefaultTeiidVersion implements TeiidVersion { @Override public boolean compareTo(TeiidVersion otherVersion) { String entryMajor = otherVersion.getMajor(); if (! getMajor().equals(entryMajor) && ! getMajor().equals(WILDCARD) && ! entryMajor.equals(WILDCARD)) return false; String entryMinor = otherVersion.getMinor(); if (! getMinor().equals(entryMinor) && ! getMinor().equals(WILDCARD) && ! entryMinor.equals(WILDCARD)) return false; String entryMicro = otherVersion.getMicro(); if (! getMicro().equals(entryMicro) && ! getMicro().equals(WILDCARD) && ! entryMicro.equals(WILDCARD)) return false; return true; } DefaultTeiidVersion(String major, String minor, String micro);  DefaultTeiidVersion(String versionString); @Override String toString(); @Override String getMajor(); @Override String getMinor(); @Override String getMicro(); @Override boolean hasWildCards(); @Override int hashCode(); @Override boolean equals(Object obj); @Override boolean compareTo(TeiidVersion otherVersion); @Override boolean isSevenInstance(); @Override TeiidVersion getMinimumVersion(); @Override TeiidVersion getMaximumVersion(); @Override boolean isGreaterThan(TeiidVersion otherVersion); @Override boolean isGreaterThan(Version otherVersion); @Override boolean isLessThan(TeiidVersion otherVersion); @Override boolean isLessThan(Version otherVersion); @Override boolean isGreaterThanOrEqualTo(TeiidVersion otherVersion); @Override boolean isGreaterThanOrEqualTo(Version otherVersion); @Override boolean isLessThanOrEqualTo(TeiidVersion otherVersion); @Override boolean isLessThanOrEqualTo(Version otherVersion); }
DefaultTeiidVersion implements TeiidVersion { @Override public boolean compareTo(TeiidVersion otherVersion) { String entryMajor = otherVersion.getMajor(); if (! getMajor().equals(entryMajor) && ! getMajor().equals(WILDCARD) && ! entryMajor.equals(WILDCARD)) return false; String entryMinor = otherVersion.getMinor(); if (! getMinor().equals(entryMinor) && ! getMinor().equals(WILDCARD) && ! entryMinor.equals(WILDCARD)) return false; String entryMicro = otherVersion.getMicro(); if (! getMicro().equals(entryMicro) && ! getMicro().equals(WILDCARD) && ! entryMicro.equals(WILDCARD)) return false; return true; } DefaultTeiidVersion(String major, String minor, String micro);  DefaultTeiidVersion(String versionString); @Override String toString(); @Override String getMajor(); @Override String getMinor(); @Override String getMicro(); @Override boolean hasWildCards(); @Override int hashCode(); @Override boolean equals(Object obj); @Override boolean compareTo(TeiidVersion otherVersion); @Override boolean isSevenInstance(); @Override TeiidVersion getMinimumVersion(); @Override TeiidVersion getMaximumVersion(); @Override boolean isGreaterThan(TeiidVersion otherVersion); @Override boolean isGreaterThan(Version otherVersion); @Override boolean isLessThan(TeiidVersion otherVersion); @Override boolean isLessThan(Version otherVersion); @Override boolean isGreaterThanOrEqualTo(TeiidVersion otherVersion); @Override boolean isGreaterThanOrEqualTo(Version otherVersion); @Override boolean isLessThanOrEqualTo(TeiidVersion otherVersion); @Override boolean isLessThanOrEqualTo(Version otherVersion);  }