Package org.citrusframework.variable
Class VariableExpressionSegmentMatcher
java.lang.Object
org.citrusframework.variable.VariableExpressionSegmentMatcher
Matcher that matches segments of variable expressions. The matcher is capable to match the following segments:
- indexed variables/properties segments of the form: 'var[1]'
- jsonPath segments of the form: 'jsonPath($.person.name)'
- xpath segments of the form: 'xpath(//person/name)'
Note that jsonPath and xpath segments must terminate the expression, i.e. they cannot be followed by further expressions. If a variable expression is used to access a variable from the test context it must start with a variable segment which extracts the first variable from the test context.
Sample for valid variable expressions:
- var1
- var1.var2
- var1[1]
- var1[1].var2[2]
- var1[1].var2[2].var3
- var1.jsonPath($.person.name)
- var1[1].jsonPath($.person.name)
- var1.xpath(//title[@lang='en'])
- var1[1].xpath(//title[@lang='en'])
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObtain the segment expression ot the current match.intObtain the segment index of the current match. -1 if match is not indexed of matcher has run out of matches.intObtain the total number of segments in the variable expression of this matcherObtain the variable expression which backs the matcher.booleanAttempts to find the next segment in the variable expression and sets the current segment expression as well as the current segment index.
-
Constructor Details
-
VariableExpressionSegmentMatcher
-
-
Method Details
-
getTotalSegmentCount
public int getTotalSegmentCount()Obtain the total number of segments in the variable expression of this matcher- Returns:
-
nextMatch
public boolean nextMatch()Attempts to find the next segment in the variable expression and sets the current segment expression as well as the current segment index.- Returns:
-
getVariableExpression
Obtain the variable expression which backs the matcher.- Returns:
-
getSegmentExpression
Obtain the segment expression ot the current match. Null if the matcher has run out of matches.- Returns:
-
getSegmentIndex
public int getSegmentIndex()Obtain the segment index of the current match. -1 if match is not indexed of matcher has run out of matches.- Returns:
-