use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestInsertSiblingAfter method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory fac = metaFactory.getOMFactory();
OMElement parent = fac.createOMElement("test", null);
OMText text1 = fac.createOMText("text1");
OMText text2 = fac.createOMText("text2");
parent.addChild(text1);
text1.insertSiblingAfter(text2);
assertSame(parent, text2.getParent());
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestInsertSiblingAfterOnChild method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = factory.createOMElement("test", null);
OMText text = factory.createOMText("test");
element.addChild(text);
try {
text.insertSiblingAfter(element);
fail("Expected OMException");
} catch (OMException ex) {
// Expected
}
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestInsertSiblingAfterOnOrphan method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory fac = metaFactory.getOMFactory();
OMText text1 = fac.createOMText("text1");
OMText text2 = fac.createOMText("text2");
try {
text1.insertSiblingBefore(text2);
fail("Expected OMException because node has no parent");
} catch (OMException ex) {
// Expected
}
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestInsertSiblingAfterSameParent method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory fac = metaFactory.getOMFactory();
OMElement parent = fac.createOMElement("test", null);
OMText text1 = fac.createOMText("text1");
OMText text2 = fac.createOMText("text2");
OMText text3 = fac.createOMText("text3");
parent.addChild(text1);
parent.addChild(text2);
parent.addChild(text3);
text1.insertSiblingAfter(text3);
assertSame(parent, text3.getParent());
Iterator<OMNode> it = parent.getChildren();
assertSame(text1, it.next());
assertSame(text3, it.next());
assertSame(text2, it.next());
assertFalse(it.hasNext());
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestInsertSiblingBeforeOnChild method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = factory.createOMElement("test", null);
OMText text = factory.createOMText("test");
element.addChild(text);
try {
text.insertSiblingBefore(element);
fail("Expected OMException");
} catch (OMException ex) {
// Expected
}
}
Aggregations