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

Match nodes whose child-nodes fulfill other node matchers

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: 5.3.1
    • Fix Version/s: 5.3.2
    • Component/s: testing
    • Labels:

      Description

      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")
                      ));

        Checklists

        Acceptance criteria

          Attachments

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Checklists

                  DoD