Class JavaHelper

java.lang.Object
com.shaft.tools.internal.support.JavaHelper

public class JavaHelper extends Object
  • Method Details

    • replaceRegex

      public 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
      Parameters:
      specialCharactersArray - an array of the special characters that will be escaped
      text - the string that will have its special characters escaped
      Returns:
      updated texts with escaped special characters
    • removeSpecialCharacters

      public static String removeSpecialCharacters(String text)
    • replaceRegex

      public static String replaceRegex(String text)
      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

      public static String encodeToBase64String(String text)
    • 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 assertion
      actualValue - the actual value (calculated data) of this assertion
      comparisonType - 1 is literalComparison, 2 is regexComparison, 3 is containsComparison, 4 is caseInsensitiveComparison
      validationType - 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

      public static String formatLocatorToString(org.openqa.selenium.By locator)
    • convertToSentenceCase

      public static String convertToSentenceCase(String text)
    • appendTestDataToRelativePath

      public static String appendTestDataToRelativePath(String relativePath)