// Regression for HARMONY-2459
public void testReplace04() {
PlainDocument document = new PlainDocument();
Element elem = new DummyElement();
AbstractDocument.BranchElement branchElem =
document.new BranchElement(elem, (AttributeSet) null);
Element[] arr0 = new Element[] {null, null, null};
try {
branchElem.replace(Integer.MIN_VALUE, 5, arr0);
fail("ArrayIndexOutOfBoundsException is expected");
} catch (ArrayIndexOutOfBoundsException ex) {
// valid
}
try {
branchElem.replace(0, -1, arr0);
fail("ArrayIndexOutOfBoundsException is expected");
} catch (ArrayIndexOutOfBoundsException ex) {
// valid
}
try {
branchElem.replace(1, 5, arr0);
fail("ArrayIndexOutOfBoundsException is expected");
} catch (ArrayIndexOutOfBoundsException ex) {
// valid
}
try {
branchElem.replace(0, 2, arr0);
fail("ArrayIndexOutOfBoundsException is expected");
} catch (ArrayIndexOutOfBoundsException ex) {
// valid
}
}