Package com.shaft.tools.internal.support
Class JavaHelper
java.lang.Object
com.shaft.tools.internal.support.JavaHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
appendTestDataToRelativePath
(String relativePath) static int
compareTwoObjects
(Object expectedValue, Object actualValue, Object comparisonType, Boolean validationType) Compares two objects (that can be cast to a string value) based on the selected comparisonType and ValidationType, then returns the result in an integer valuestatic String
convertToSentenceCase
(String text) static String
encodeToBase64String
(String text) static String
formatLocatorToString
(org.openqa.selenium.By locator) static String
static String
replaceRegex
(String text) Returns text after replaces its regular expressions which included in this set []^$.|?static String
replaceRegex
(String[] specialCharactersArray, String text) Takes two parameters, one is the array of special characters that are needed to be replaced, and the text needed to be updated It converts text with %40%23%24%25%26 ..etc (special characters) to return it with %5C%5C%40%5C%5C%23%5C%5C%24%5C%5C%25%5C%5C%26
-
Method Details
-
replaceRegex
Takes two parameters, one is the array of special characters that are needed to be replaced, and the text needed to be updated It converts text with %40%23%24%25%26 ..etc (special characters) to return it with %5C%5C%40%5C%5C%23%5C%5C%24%5C%5C%25%5C%5C%26- Parameters:
specialCharactersArray
- an array of the special characters that will be escapedtext
- the string that will have its special characters escaped- Returns:
- updated texts with escaped special characters
-
removeSpecialCharacters
-
replaceRegex
Returns text after replaces its regular expressions which included in this set []^$.|?*+(){}- Parameters:
text
- the string that will have its special characters escaped- Returns:
- updated text after escaping its regular expressions
-
encodeToBase64String
-
compareTwoObjects
public static int compareTwoObjects(Object expectedValue, Object actualValue, Object comparisonType, Boolean validationType) Compares two objects (that can be cast to a string value) based on the selected comparisonType and ValidationType, then returns the result in an integer value- Parameters:
expectedValue
- the expected value (test data) of this assertionactualValue
- the actual value (calculated data) of this assertioncomparisonType
- 1 is literalComparison, 2 is regexComparison, 3 is containsComparison, 4 is caseInsensitiveComparisonvalidationType
- either 'true' for a positive assertion that the objects are equal, or 'false' for a negative assertion that the objects are not equal- Returns:
- integer value; 1 in case of match, 0 in case of no match, -1 in case of invalid comparison operator, -2 in case of another unhandled exception
-
formatLocatorToString
-
convertToSentenceCase
-
appendTestDataToRelativePath
-