@Test public void testVersionHelper() { String verOne[] = {"1.2.3","6.8.83.4","5.0","snapshot-2.3.5", "something-0.333.447...-nice" }; String verTwo[] = {"1.2.1","6.8.83","5.9","2.3-snapshot", "0.345...777" }; boolean results[] = {false, false, true, false, true, false}; int intResults[] = {1,1,-1,1,-1}; for(int i=0;i<verOne.length;i++) { assertEquals(VersionHelper.compareVersion(verOne[i],verTwo[i]), intResults[i]); } for(int i=0;i<verOne.length;i++) { assertEquals(VersionHelper.compareVersion(verTwo[i],verOne[i]), -1*intResults[i]); } assertEquals(VersionHelper.compareVersion("7.7.7","7.7.7"), 0); }
public static int compareVersion(String versionOne, String versionTwo) { try { return compareVersionInt(versionOne, versionTwo); } catch (IllegalArgumentException iae) { return -1; } }
VersionHelper { public static int compareVersion(String versionOne, String versionTwo) { try { return compareVersionInt(versionOne, versionTwo); } catch (IllegalArgumentException iae) { return -1; } } }
VersionHelper { public static int compareVersion(String versionOne, String versionTwo) { try { return compareVersionInt(versionOne, versionTwo); } catch (IllegalArgumentException iae) { return -1; } }  }
VersionHelper { public static int compareVersion(String versionOne, String versionTwo) { try { return compareVersionInt(versionOne, versionTwo); } catch (IllegalArgumentException iae) { return -1; } }  static int compareVersion(String versionOne, String versionTwo); }
VersionHelper { public static int compareVersion(String versionOne, String versionTwo) { try { return compareVersionInt(versionOne, versionTwo); } catch (IllegalArgumentException iae) { return -1; } }  static int compareVersion(String versionOne, String versionTwo);  }