Package org.citrusframework.variable
Class VariableUtils
java.lang.Object
org.citrusframework.variable.VariableUtils
Utility class manipulating test variables.
- Author:
- Christoph Deppisch
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Details
-
getValueFromScript
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
Cut off single quotes prefix and suffix.- Parameters:
variable-- Returns:
-
cutOffDoubleQuotes
Cut off double quotes prefix and suffix.- Parameters:
variable-- Returns:
-
cutOffVariablesPrefix
Cut off variables prefix- Parameters:
variable-- Returns:
-
cutOffVariablesEscaping
Cut off variables escaping- Parameters:
variable-- Returns:
-
isVariableName
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:
-