Element parent = new Element("parent");
Text child = new Text("child");
parent.appendChild(child);
try {
parent.replaceChild(child, new DocType("root"));
fail("allowed doctype child of element");
}
catch (IllegalAddException success) {
assertEquals(parent, child.getParent());
assertEquals(1, parent.getChildCount());