Package org.xmlunit.diff
Interface ElementSelectors.ConditionalSelectorBuilder
- Enclosing class:
- ElementSelectors
public static interface ElementSelectors.ConditionalSelectorBuilder
Allows to build complex
ElementSelector
s by combining simpler blocks.
All when*
s are consulted in order and if one returns
true
then the associated ElementSelector
is
used. If all of the, return false
, the default set up
with elseUse
if any is used.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a conditional ElementSelector.Assigns a default ElementSelector that is used if allwhen
s have returned false.Sets up a conditional ElementSelector.whenElementIsNamed
(String expectedName) Sets up a conditional ElementSelector.whenElementIsNamed
(QName expectedName) Sets up a conditional ElementSelector.
-
Method Details
-
when
Sets up a conditional ElementSelector.- Parameters:
predicate
- the condition that must hold true- Returns:
- a then-part setting up the ElementSelector to use
-
whenElementIsNamed
Sets up a conditional ElementSelector.- Parameters:
expectedName
- expected name of the control element- Returns:
- a then-part setting up the ElementSelector to use
-
whenElementIsNamed
Sets up a conditional ElementSelector.- Parameters:
expectedName
- expected name of the control element- Returns:
- a then-part setting up the ElementSelector to use
-
elseUse
Assigns a default ElementSelector that is used if allwhen
s have returned false.- Parameters:
es
- the default ElementSelector to fall back to- Returns:
- the builder
-
build
ElementSelector build()Builds a conditional ElementSelector.- Returns:
- an ElementSelector adhering to the ocnfigured conditions.
-