buffer.append((CharArrayBuffer)null, 0, 0);
assertEquals(0, buffer.length());
}
public void testInvalidAppendCharArrayAsAscii() throws Exception {
ByteArrayBuffer buffer = new ByteArrayBuffer(4);
buffer.append((char[])null, 0, 0);
char[] tmp = new char[] { '1', '2', '3', '4'};
try {
buffer.append(tmp, -1, 0);
fail("IndexOutOfBoundsException should have been thrown");
} catch (IndexOutOfBoundsException ex) {
// expected
}
try {
buffer.append(tmp, 0, -1);
fail("IndexOutOfBoundsException should have been thrown");
} catch (IndexOutOfBoundsException ex) {
// expected
}
try {
buffer.append(tmp, 0, 8);
fail("IndexOutOfBoundsException should have been thrown");
} catch (IndexOutOfBoundsException ex) {
// expected
}
try {
buffer.append(tmp, 10, Integer.MAX_VALUE);
fail("IndexOutOfBoundsException should have been thrown");
} catch (IndexOutOfBoundsException ex) {
// expected
}
try {
buffer.append(tmp, 2, 4);
fail("IndexOutOfBoundsException should have been thrown");
} catch (IndexOutOfBoundsException ex) {
// expected
}
}