Package org.codice.ddf.test.common.dom
Class DomSupport
java.lang.Object
org.codice.ddf.test.common.dom.DomSupport
This class provides support for handling DOM trees while testing.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleananyNodeInTheHierarchyMatches(Node node, Predicate<Node> predicate) Checks the given node's complete hierarchy (i.e. the node itself, its ancestors, and its lineage) to see if the provided predicate reportstruefor at least one node.static booleananyNodesInTheAncestryMatches(Node node, Predicate<Node> predicate) Checks the given node's ancestors to see if the provided predicate reportstruefor at least one node.anyNodesInTheHierarchy(Predicate<Node> predicate) Returns a new predicate that will reporttrueif any of the nodes in the hierarchy of the tested node yieldstruewhen tested with the provided predicate.static booleananyNodesInTheLineageMatches(Node node, Predicate<Node> predicate) Checks the given node's descendants to see if the provided predicate reportstruefor at least one node.
-
Method Details
-
anyNodesInTheHierarchy
Returns a new predicate that will reporttrueif any of the nodes in the hierarchy of the tested node yieldstruewhen tested with the provided predicate.- Parameters:
predicate- the predicate to test with- Returns:
- a new predicate that will test the given predicate against all nodes in the hierarchy
of its tested node until one report
true
-
anyNodeInTheHierarchyMatches
Checks the given node's complete hierarchy (i.e. the node itself, its ancestors, and its lineage) to see if the provided predicate reportstruefor at least one node. This method will stop searching as soon as the predicate reportstruefor any node in the hierarchy.- Parameters:
node- the node to test the predicate against its hierarchypredicate- the predicate to test with- Returns:
trueif the predicate reportstruefor at least one node;falseotherwise
-
anyNodesInTheAncestryMatches
Checks the given node's ancestors to see if the provided predicate reportstruefor at least one node. This method will stop searching as soon as the predicate reportstruefor any node in the ancestry.- Parameters:
node- the node to test the predicate against its ancestrypredicate- the predicate to test with- Returns:
trueif the predicate reportstruefor at least one node;falseotherwise
-
anyNodesInTheLineageMatches
Checks the given node's descendants to see if the provided predicate reportstruefor at least one node. This method will stop searching as soon as the predicate reportstruefor any node in the lineage.- Parameters:
node- the node to test the predicate against its lineagepredicate- the predicate to test with- Returns:
trueif the predicate reportstruefor at least one node;falseotherwise
-