/**
* Test the removal of node and its parent nodes.
*/
public void testRemoveGrandparentNodes() throws Exception {
ODOMElement one = (ODOMElement) factory.element("one");
ODOMElement two = (ODOMElement) factory.element("two");
ODOMElement three = (ODOMElement) factory.element("three");
ODOMAttribute threeAttrib =
(ODOMAttribute) factory.attribute("threeAttrib", "");
one.addContent(two);
two.addContent(three);
three.setAttribute(threeAttrib);
ODOMXPath oneToThree = new ODOMXPath("two/three");
ODOMXPath oneToThreeAttrib = new ODOMXPath(oneToThree,
"@" + threeAttrib.getName());
// Do the removal.
ODOMObservable observable = oneToThreeAttrib.remove(one);
assertNotNull("Node shouldn't be null", observable);
assertTrue("Type should match", observable instanceof ODOMElement);
ODOMElement element = (ODOMElement) observable;
assertEquals("Name should match", "two", element.getName());
}