byte array[] = new byte[BUFFER_LENGTH];
try {
ByteBuffer.wrap(array, -1, 0);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
ByteBuffer.wrap(array, BUFFER_LENGTH + 1, 0);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
ByteBuffer.wrap(array, 0, -1);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
ByteBuffer.wrap(array, 0, BUFFER_LENGTH + 1);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
ByteBuffer.wrap(array, 1, Integer.MAX_VALUE);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
ByteBuffer.wrap(array, Integer.MAX_VALUE, 1);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
ByteBuffer.wrap((byte[])null, 1, Integer.MAX_VALUE);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (NullPointerException e) {
// expected
}