* Test the creation of an ODOMXPath.
*/
public void testCreateSimple() throws Exception {
// Check when element does not exist.
String elementName = "newElement";
ODOMXPath path = new ODOMXPath(elementName);
ODOMObservable result = path.create((ODOMElement) root, factory);
assertNotNull("Result should not be null", result);
assertTrue("Type should match", result instanceof Element);
assertEquals("Value should match", elementName,
((Element) result).getName());
// Check when attribute does not exist.
path = new ODOMXPath("newElement/@attribute");
result = path.create((ODOMElement) root, factory);
assertNotNull("Result should not be null", result);
assertTrue("Type should match", result instanceof Attribute);
assertEquals("Value should match", "attribute",
((Attribute) result).getName());
assertEquals("Value should match", "",
((Attribute) result).getValue());
// Check when text does not exist.
path = new ODOMXPath("newElement/text()");
result = path.create((ODOMElement) root, factory);
assertNotNull("Result should not be null", result);
assertTrue("Type should match", result instanceof Text);
assertEquals("Value should match", "",
((Text) result).getText());