Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A test for ElementSelectors which currently fails for byNameAndTextRec #28

Closed
wants to merge 1 commit into from

Conversation

benroe89
Copy link
Contributor

No description provided.

bodewig added a commit that referenced this pull request May 13, 2015
@bodewig
Copy link
Member

bodewig commented May 13, 2015

byElementNameAndTextRec is the secret child of RecursiveElementNameAndTextQualifier and I don't think this one would work for your structure either. I haven't tried, does it?

MultiLevelElementNameAndTextQualifier is an entirely different beast that I don't really want to recreate here - most of the time you don't want to use it for your entire tree. The alternative I'd prefer consists of chaining different ElementSelectors, something like

        ElementSelector s = ElementSelectors.conditionalBuilder()
            .whenElementIsNamed("value").thenUse(ElementSelectors.byNameAndText)
            .whenElementIsNamed("sub")
            .thenUse(ElementSelectors.byXPath("./value", 
                                              ElementSelectors.byNameAndText))
            .defaultTo(ElementSelectors.byName)
            .build();

see branch pr-28

@benroe89
Copy link
Contributor Author

The byElementNameAndTextRec is not working as shown by the failed build.
The MultiLevelElementNameAndTextQualifier is only provided for XMLUnit 1.x so far I guess.

Is there a more general solution so I don't have to accommodate each test?

@bodewig
Copy link
Member

bodewig commented May 19, 2015

MultiLevelElementNameAndTextQualifier has become the hammer that's gotten used for way too many things, that's why I have shied away from porting it. Personally I'm convinced you'd be better of with putting together an ElementSelector that matches the logic of your document. Anyway, I opened #29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants