VersionUtils { public static Boolean isVersionGreaterOrEquals(String version1, String version2) throws ValidationException { String v1 = completeIncremental(version1); String v2 = completeIncremental(version2); return parseVersion(v1).compareTo(parseVersion(v2)) >= 0; }  static Boolean isVersionValid(String version); static Boolean isVersionGreaterOrEquals(String version1, String version2); static String completeIncremental(String version); static String getBaseVersion(String version); static String getMajor(String version); static boolean isRange(String version);  }
@Test(expected = ValidationException.class) public void isVersionGraterOrEqualsIllegalVersion1() throws ValidationException { String version1 = "3.3.9.9"; String version2 = "3.3.2"; isVersionGreaterOrEquals(version1, version2); }
@Test(expected = ValidationException.class) public void isVersionGraterOrEqualsIllegalVersion2() throws ValidationException { String version1 = "3.3.9"; String version2 = "3.3.2.50"; isVersionGreaterOrEquals(version1, version2); }
@Test public void isVersionGraterOrEqualsTrue() throws ValidationException { String version1 = "3.3.9"; String version2 = "3.3.2"; assertThat(isVersionGreaterOrEquals(version1, version2), is(true)); }
@Test public void isVersionGraterOrEqualsTrue1() throws ValidationException { String version1 = "3.5.0"; String version2 = "3.3.3"; assertThat(isVersionGreaterOrEquals(version1, version2), is(true)); }
@Test public void isVersionGraterOrEqualsTrue2() throws ValidationException { String version1 = "3.0.0"; String version2 = "2.1.3"; assertThat(isVersionGreaterOrEquals(version1, version2), is(true)); }
@Test public void isVersionGraterOrEqualsFalse1() throws ValidationException { String version1 = "3.0.5"; String version2 = "3.3.3"; assertThat(isVersionGreaterOrEquals(version1, version2), is(false)); }
@Test public void isVersionGraterOrEqualsFalse2() throws ValidationException { String version1 = "3.0.0"; String version2 = "4.0.0"; assertThat(isVersionGreaterOrEquals(version1, version2), is(false)); }
@Test public void isVersionGraterOrEqualsTrueVersion2Incomplete() throws ValidationException { String version1 = "3.3.9"; String version2 = "3.3"; assertThat(isVersionGreaterOrEquals(version1, version2), is(true)); }
@Test public void isVersionGraterOrEqualsFalse() throws ValidationException { String version1 = "3.3.2"; String version2 = "3.3.9"; assertThat(isVersionGreaterOrEquals(version1, version2), is(false)); }
@Test public void isVersionGraterOrEqualsFalseVersion1Incomplete() throws ValidationException { String version1 = "3.3"; String version2 = "3.3.9"; assertThat(isVersionGreaterOrEquals(version1, version2), is(false)); }
@Test public void isVersionGraterOrEqualsSnapshotTrue() throws ValidationException { String version1 = "3.3.9-SNAPSHOT"; String version2 = "3.3.2"; assertThat(isVersionGreaterOrEquals(version1, version2), is(true)); }
@Test public void isVersionGraterOrEqualsSNAPSHOTFalse() throws ValidationException { String version1 = "3.3.2"; String version2 = "3.3.9-SNAPSHOT"; assertThat(isVersionGreaterOrEquals(version1, version2), is(false)); }