double array[] = new double[20];
try {
DoubleBuffer.wrap(array, -1, 0);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
DoubleBuffer.wrap(array, 21, 0);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
DoubleBuffer.wrap(array, 0, -1);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
DoubleBuffer.wrap(array, 0, 21);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
DoubleBuffer.wrap(array, Integer.MAX_VALUE, 1);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
DoubleBuffer.wrap(array, 1, Integer.MAX_VALUE);
fail("Should throw Exception"); //$NON-NLS-1$
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
DoubleBuffer.wrap((double[])null, -1, 0);
fail("Should throw NPE"); //$NON-NLS-1$
} catch (NullPointerException e) {
}
DoubleBuffer buf = DoubleBuffer.wrap(array, 2, 16);
assertEquals(buf.position(), 2);
assertEquals(buf.limit(), 18);
assertEquals(buf.capacity(), 20);