Skip to content

MultipleNodeAssert: asserting node text of all nodes #192

@keesvandieren

Description

@keesvandieren

Given a list of DOM nodes with texts, we'd like to assert that the texts of the elements matches an array of strings we have in Java.

For attributes, there is extractingAttribute which makes this easy for attributes.

We'd like to have an extractingText there to do the same for element texts.

We would like to write the following test (we are testing an XSL-FO document):

        assertThat(letterDocument)
                .withNamespaceContext(XSL_FO_NAMESPACE_CONTEXT)
                .nodesByXPath("//fo:block[@id='recipient-address']/fo:block")
                .extractingText()
                .containsExactly("John Doo",
                        "Street 213423",
                        "2944 AA Amsterdam",
                        "The Netherlands");

So far I am unable to write well-written assertions to test this.

Maybe I am missing something?

Would you accept a PR for such an extractingText() method?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions