Skip to content

Commit

Permalink
A test for ElementSelectors which currently fails for byNameAndTextRec
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminr-ps committed May 13, 2015
1 parent 81bb26a commit e4ddf1c
Showing 1 changed file with 48 additions and 0 deletions.
Expand Up @@ -129,6 +129,54 @@ private void byNameAndText_SingleLevel(ElementSelector s) {
assertFalse(s.canBeCompared(control, differentElement));
assertFalse(s.canBeCompared(control, differentText));
}


@Test public void byNameAndTextRec_Multilevel() {
Element control = doc.createElement("root");
{
Element controlSub = doc.createElement("sub");
control.appendChild(controlSub);
Element controlSubSubValue = doc.createElement("value");
controlSub.appendChild(controlSubSubValue);
controlSubSubValue.appendChild(doc.createTextNode("1"));
controlSubSubValue = doc.createElement("value");
controlSub.appendChild(controlSubSubValue);
controlSubSubValue.appendChild(doc.createTextNode("2"));

controlSub = doc.createElement("sub");
control.appendChild(controlSub);
controlSubSubValue = doc.createElement("value");
controlSub.appendChild(controlSubSubValue);
controlSubSubValue.appendChild(doc.createTextNode("3"));
controlSubSubValue = doc.createElement("value");
controlSub.appendChild(controlSubSubValue);
controlSubSubValue.appendChild(doc.createTextNode("4"));
}

Element test = doc.createElement("root");
{
Element testSub = doc.createElement("sub");
test.appendChild(testSub);
Element testSubValue = doc.createElement("value");
testSub.appendChild(testSubValue);
testSubValue.appendChild(doc.createTextNode("3"));
testSubValue = doc.createElement("value");
testSub.appendChild(testSubValue);
testSubValue.appendChild(doc.createTextNode("4"));

testSub = doc.createElement("sub");
test.appendChild(testSub);
testSubValue = doc.createElement("value");
testSub.appendChild(testSubValue);
testSubValue.appendChild(doc.createTextNode("1"));
testSubValue = doc.createElement("value");
testSub.appendChild(testSubValue);
testSubValue.appendChild(doc.createTextNode("2"));
}

ElementSelector s = ElementSelectors.byNameAndTextRec;
assertTrue(s.canBeCompared(control, test));
}

@Test public void byNameAndAllAttributes_NamePart() {
pureElementNameComparisons(ElementSelectors.byNameAndAllAttributes);
Expand Down

1 comment on commit e4ddf1c

@benroe89
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will fail for the XMLUnit 2.x. The respective test with XMLUnit 1.x works fine.

The test should pass for both XMLUnit implementations.

Please sign in to comment.