-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid people from using selenium 3.7.1 with grid extras 1.
- Loading branch information
1 parent
4772fa4
commit 350f114
Showing
4 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...niumGridExtras/src/main/java/com/groupon/seleniumgridextras/utilities/VersionCompare.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.groupon.seleniumgridextras.utilities; | ||
|
||
public class VersionCompare { | ||
|
||
/** | ||
Return 1 if version1 is greater than version2 | ||
Return 0 if version 1 is equal to version2 | ||
Return -1 if version 1 is less than version2 | ||
*/ | ||
public static int versionCompare(String version1, String version2) { | ||
String[] version1Split = version1.split("\\."); | ||
String[] version2Split = version2.split("\\."); | ||
int major1 = (version1Split.length > 0) ? Integer.parseInt(version1Split[0]) : 0; | ||
int minor1 = (version1Split.length > 1) ? Integer.parseInt(version1Split[1]) : 0; | ||
int patch1 = (version1Split.length > 2) ? Integer.parseInt(version1Split[2]) : 0; | ||
|
||
int major2 = (version2Split.length > 0) ? Integer.parseInt(version2Split[0]) : 0; | ||
int minor2 = (version2Split.length > 1) ? Integer.parseInt(version2Split[1]) : 0; | ||
int patch2 = (version2Split.length > 2) ? Integer.parseInt(version2Split[2]) : 0; | ||
if (major1 > major2) { | ||
return 1; | ||
} else if (major1 < major2) { | ||
return -1; | ||
} else { // Majors match | ||
if (minor1 > minor2) { | ||
return 1; | ||
} else if (minor1 < minor2) { | ||
return -1; | ||
} else { | ||
if (patch1 > patch2) { | ||
return 1; | ||
} else if (patch1 < patch2) { | ||
return -1; | ||
} else { | ||
return 0; | ||
} | ||
} | ||
} | ||
} | ||
} |