@Test public void testGreaterOrEqualThan() { boolean greaterOrEqual = version4_1.greaterOrEqualThan(version4_1_3); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4_1_2); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4_1_4); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4_2_1); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4_0_1); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version5_1_3); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version3_1_3); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4_1); assertTrue(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4_2); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4_0); assertTrue(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version5_1); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version3_1); assertFalse(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version4); assertTrue(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version3); assertTrue(greaterOrEqual); greaterOrEqual = version4_1.greaterOrEqualThan(version5); assertFalse(greaterOrEqual); }
@Override public boolean greaterOrEqualThan(Version version) { String[] split = version.name().split(DOT_REGEX); if (split.length < 1 || split.length > 3) { throw new IllegalArgumentException("Version class format is not compliant"); } if (split.length == 3) { return parseInt(split[0]) == this.major() && parseInt(split[1]) == this.minor() && parseInt(split[2]) <= this.patch(); } if (split.length == 2) { return parseInt(split[0]) == this.major() && parseInt(split[1]) <= this.minor(); } return parseInt(split[0]) <= this.major(); }
BackwardsCompatibleVersion implements Version { @Override public boolean greaterOrEqualThan(Version version) { String[] split = version.name().split(DOT_REGEX); if (split.length < 1 || split.length > 3) { throw new IllegalArgumentException("Version class format is not compliant"); } if (split.length == 3) { return parseInt(split[0]) == this.major() && parseInt(split[1]) == this.minor() && parseInt(split[2]) <= this.patch(); } if (split.length == 2) { return parseInt(split[0]) == this.major() && parseInt(split[1]) <= this.minor(); } return parseInt(split[0]) <= this.major(); } }
BackwardsCompatibleVersion implements Version { @Override public boolean greaterOrEqualThan(Version version) { String[] split = version.name().split(DOT_REGEX); if (split.length < 1 || split.length > 3) { throw new IllegalArgumentException("Version class format is not compliant"); } if (split.length == 3) { return parseInt(split[0]) == this.major() && parseInt(split[1]) == this.minor() && parseInt(split[2]) <= this.patch(); } if (split.length == 2) { return parseInt(split[0]) == this.major() && parseInt(split[1]) <= this.minor(); } return parseInt(split[0]) <= this.major(); } BackwardsCompatibleVersion(String name); }
BackwardsCompatibleVersion implements Version { @Override public boolean greaterOrEqualThan(Version version) { String[] split = version.name().split(DOT_REGEX); if (split.length < 1 || split.length > 3) { throw new IllegalArgumentException("Version class format is not compliant"); } if (split.length == 3) { return parseInt(split[0]) == this.major() && parseInt(split[1]) == this.minor() && parseInt(split[2]) <= this.patch(); } if (split.length == 2) { return parseInt(split[0]) == this.major() && parseInt(split[1]) <= this.minor(); } return parseInt(split[0]) <= this.major(); } BackwardsCompatibleVersion(String name); @Override String name(); @Override boolean greaterOrEqualThan(Version version); }
BackwardsCompatibleVersion implements Version { @Override public boolean greaterOrEqualThan(Version version) { String[] split = version.name().split(DOT_REGEX); if (split.length < 1 || split.length > 3) { throw new IllegalArgumentException("Version class format is not compliant"); } if (split.length == 3) { return parseInt(split[0]) == this.major() && parseInt(split[1]) == this.minor() && parseInt(split[2]) <= this.patch(); } if (split.length == 2) { return parseInt(split[0]) == this.major() && parseInt(split[1]) <= this.minor(); } return parseInt(split[0]) <= this.major(); } BackwardsCompatibleVersion(String name); @Override String name(); @Override boolean greaterOrEqualThan(Version version);  }