testDoc = new PlainDocument() {
private static final long serialVersionUID = 1L;
@Override
protected AbstractElement createDefaultRoot() {
AbstractElement root = new LeafElement(null, null, 0, 1);
return root;
}
};
if (BasicSwingTestCase.isHarmony()) {
fail("ClassCastException must be thrown");
}
} catch (ClassCastException e) {
}
if (BasicSwingTestCase.isHarmony()) {
assertNull(testDoc);
return;
}
AbstractElement root = (AbstractElement) testDoc.getDefaultRootElement();
assertTrue(root instanceof LeafElement);
assertEquals(AbstractDocument.ContentElementName, root.getName());
assertEquals(0, root.getElementCount());
assertFalse(root.getAllowsChildren());
// Try to insert some text
try {
testDoc.insertString(0, "text", null);
fail("ClassCastException must be thrown");
} catch (ClassCastException e) {