Package io.github.the_sdet.common
Class CommonUtils
java.lang.Object
io.github.the_sdet.common.CommonUtils
This class handles various common Utilities and Helper methods
- Author:
- Pabitra Swain ([email protected])
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum representing the status of a test scenario. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatDate(String inputDateStr, String inputDateFormat, String outputDateFormat) Format a date string from one format to another.static intgetIntegerValue(String elementText) This method extracts numeric integer value from a string.static doublegetNumericValue(String elementText) This method extracts numeric value from a string.static StringreplaceLineBreaksWithSpace(String input) Replaces line breaks in the input string with spaces.static voidWaits for the specified duration.
-
Field Details
-
EMPTY_STRING
Represents a String without content.
-
-
Constructor Details
-
CommonUtils
public CommonUtils()
-
-
Method Details
-
getNumericValue
This method extracts numeric value from a string. E.g., -$300.00 will return 300.00- Parameters:
elementText- String value from which number to be extracted.- Returns:
- number in double format
-
getIntegerValue
This method extracts numeric integer value from a string. E.g., -$300.00 will return 300- Parameters:
elementText- String value from which number to be extracted.- Returns:
- number in integer format
-
waitFor
Waits for the specified duration.- Parameters:
duration- The duration to wait.
-
replaceLineBreaksWithSpace
Replaces line breaks in the input string with spaces.- Parameters:
input- The input string.- Returns:
- The input string with line breaks replaced by spaces.
-
formatDate
public static String formatDate(String inputDateStr, String inputDateFormat, String outputDateFormat) Format a date string from one format to another.- Parameters:
inputDateStr- The input date string.inputDateFormat- The input date format.outputDateFormat- The output date format.- Returns:
- the formatted date string.
-