Package com.consol.citrus.variable
Class VariableUtils
- java.lang.Object
-
- com.consol.citrus.variable.VariableUtils
-
public final class VariableUtils extends Object
Utility class manipulating test variables.- Author:
- Christoph Deppisch
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcutOffDoubleQuotes(String variable)Cut off double quotes prefix and suffix.static StringcutOffSingleQuotes(String variable)Cut off single quotes prefix and suffix.static StringcutOffVariablesEscaping(String variable)Cut off variables escapingstatic StringcutOffVariablesPrefix(String variable)Cut off variables prefixstatic StringgetValueFromScript(String scriptEngine, String code)Evaluates script code and returns a variable value as result.static booleanisVariableName(String expression)Checks whether a given expression is a variable name.static StringreplaceVariablesInString(String str, TestContext context, boolean enableQuoting)Replace all variable expression in a string with its respective value.
-
-
-
Method Detail
-
getValueFromScript
public static String getValueFromScript(String scriptEngine, String code)
Evaluates script code and returns a variable value as result.- Parameters:
scriptEngine- the name of the scripting engine.code- the script code.- Returns:
- the variable value as String.
-
cutOffSingleQuotes
public static String cutOffSingleQuotes(String variable)
Cut off single quotes prefix and suffix.- Parameters:
variable-- Returns:
-
cutOffDoubleQuotes
public static String cutOffDoubleQuotes(String variable)
Cut off double quotes prefix and suffix.- Parameters:
variable-- Returns:
-
cutOffVariablesPrefix
public static String cutOffVariablesPrefix(String variable)
Cut off variables prefix- Parameters:
variable-- Returns:
-
cutOffVariablesEscaping
public static String cutOffVariablesEscaping(String variable)
Cut off variables escaping- Parameters:
variable-- Returns:
-
isVariableName
public static boolean isVariableName(String expression)
Checks whether a given expression is a variable name.- Parameters:
expression-- Returns:
- flag true/false
-
replaceVariablesInString
public static String replaceVariablesInString(String str, TestContext context, boolean enableQuoting)
Replace all variable expression in a string with its respective value. Variable values are enclosed with quotes if enabled.- Parameters:
str-context-enableQuoting-- Returns:
-
-