public void testReplaceSelectionWithAttributes() {
if (true) {
throw new UnsupportedOperationException("Not implemented");
}
AbstractDocument doc = new DefaultStyledDocument();
SimpleAttributeSet as1 = new SimpleAttributeSet();
as1.addAttribute("key1", "value1");
SimpleAttributeSet as2 = new SimpleAttributeSet();
as2.addAttribute("key2", "value2");
try {
doc.insertString(0, "testReplaceSelection", as1);
doc.insertString(4, "INSERT", as2);
} catch (final BadLocationException e) {
assertFalse("unexpected exception :" + e.getMessage(), true);
}
//temporarily commented-out: HTMLEditorKit not implemented
//jep.setEditorKit(new RTFEditorKit());
jep.setEditorKit(new StyledEditorKit());
jep.setDocument(doc);
jep.setSelectionStart(6);
jep.setSelectionEnd(7);
jep.replaceSelection("YYY");
for (int i = 0; i < doc.getLength(); i++) {
AttributeSet as = getAttributeSetByIndex(doc, i);
if (i > 3 && i < 12) {
assertEquals(as2, as);
} else {
assertEquals(as1, as);