Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5867

Match nodes whose child-nodes fulfill other node matchers

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.3.2
    • 5.3.1
    • testing

      NodeMatchers currently provides several #hasNode(...) matchers, but only checking explicit name and node-type, as Strings.

      In some cases where the node name doesn't necessarily matter, it would be handy to have a #hasNode(Matcher<Node>) method for evaluating child-nodes, in the similar spirit as #hasProperty(Matcher<Property>).

      We can then add similar convenience methods for matching node name, or a node with a child node whose name matches further rules, e.g.:

              assertThat(node, hasNode(hasProperty("property", "value")));
              assertThat(node, hasNode(nodeName(endsWith("nut"))));
              assertThat(node, hasNode(
                      Matchers.<Node> allOf(
                              nodeName(endsWith("nut")),
                              hasProperty("property", "value")
                      ));

        Acceptance criteria

              mgeljic Mikaël Geljić
              mgeljic Mikaël Geljić
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD