DefaultTeiidVersion implements TeiidVersion { @Override public boolean isLessThan(TeiidVersion otherVersion) { TeiidVersion myMaxVersion = getMaximumVersion(); TeiidVersion otherMinVersion = otherVersion.getMinimumVersion(); int majCompResult; try { int myMax = Integer.parseInt(myMaxVersion.getMajor()); int otherMin = Integer.parseInt(otherMinVersion.getMajor()); majCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin)); } catch (NumberFormatException ex) { majCompResult = myMaxVersion.getMajor().compareTo(otherMinVersion.getMajor()); } if (majCompResult < 0) return true; int minCompResult; try { int myMax = Integer.parseInt(myMaxVersion.getMinor()); int otherMin = Integer.parseInt(otherMinVersion.getMinor()); minCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin)); } catch (NumberFormatException ex) { minCompResult = myMaxVersion.getMinor().compareTo(otherMinVersion.getMinor()); } if (majCompResult == 0 && minCompResult < 0) return true; int micCompResult; try { int myMax = Integer.parseInt(myMaxVersion.getMicro()); int otherMin = Integer.parseInt(otherMinVersion.getMicro()); micCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin)); } catch (NumberFormatException ex) { micCompResult = myMaxVersion.getMicro().compareTo(otherMinVersion.getMicro()); } if (majCompResult == 0 && minCompResult == 0 && micCompResult < 0) return true; return false; } 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);  }
@Test public void testIsLessThan() { assertFalse(version("8.0.0").isLessThan(version("8.0.0"))); assertTrue(version("7.0.0").isLessThan(version("8.0.0"))); assertFalse(version("8.0.0").isLessThan(version("7.0.0"))); assertTrue(version("7.7.0").isLessThan(version("8.0.0"))); assertFalse(version("8.0.0").isLessThan(version("7.7.0"))); assertTrue(version("7.0.1").isLessThan(version("8.0.0"))); assertFalse(version("8.0.0").isLessThan(version("7.0.1"))); assertTrue(version("7.0.x").isLessThan(version("8.0.0"))); assertFalse(version("8.0.0").isLessThan(version("7.0.x"))); assertTrue(version("7.x.0").isLessThan(version("8.0.0"))); assertFalse(version("8.0.0").isLessThan(version("7.x.0"))); assertTrue(version("7.x.x").isLessThan(version("8.0.0"))); assertFalse(version("8.0.0").isLessThan(version("7.x.x"))); assertTrue(version("7.0.0").isLessThan(version("8.x.0"))); assertFalse(version("8.x.0").isLessThan(version("7.0.0"))); assertTrue(version("7.0.0").isLessThan(version("8.0.x"))); assertFalse(version("8.0.x").isLessThan(version("7.0.0"))); assertTrue(version("7.0.0").isLessThan(version("8.x.x"))); assertFalse(version("8.x.x").isLessThan(version("7.0.0"))); assertTrue(version("7.0.0").isLessThan(version("8.0.x"))); assertFalse(version("8.0.x").isLessThan(version("7.0.0"))); assertTrue(version("7.0.0").isLessThan(version("8.x.0"))); assertFalse(version("8.x.0").isLessThan(version("7.0.0"))); assertFalse(version("8.0.0").isLessThan(version("8.0.x"))); assertFalse(version("8.0.x").isLessThan(version("8.0.0"))); assertFalse(version("8.0.0").isLessThan(version("8.x.0"))); assertFalse(version("8.x.0").isLessThan(version("8.0.0"))); assertTrue(version("8.0.0").isLessThan(version("8.1.extendedmicroversionid"))); assertTrue(version("8.designer-1.0").isLessThan(version("8.designer-2.0"))); assertTrue(version("8.designer-1.0").isLessThan(version("8.designer-10.0"))); assertTrue(version("8.designer-20.0").isLessThan(version("8.teiidteiid-18.0"))); assertFalse(version("8.teiidteiid-18.0").isLessThan(version("8.designer-20.0"))); assertTrue(version("8.7.0").isLessThan(version("8.7.1"))); assertTrue(version("8.8.0").isLessThan(version("8.10.0"))); assertFalse(version("8.7.1").isLessThan(version("8.7.x"))); }
@Test public void testIsLessThan2() { assertTrue(Version.TEIID_8_12_4.get().isLessThan(version("9.0.0"))); assertFalse(Version.TEIID_8_12_4.get().isLessThan(version("8.6.0"))); }