FileDocCategorySizeDatePackage
WrappedCharBufferTest1.javaAPI DocAndroid 1.5 API3241Wed May 06 22:41:04 BST 2009org.apache.harmony.nio.tests.java.nio

WrappedCharBufferTest1

public class WrappedCharBufferTest1 extends CharBufferTest

Fields Summary
Constructors Summary
Methods Summary
protected voidsetUp()

        capacity = BUFFER_LENGTH;
        buf = CharBuffer.wrap(new char[BUFFER_LENGTH]);
        loadTestData1(buf);
        baseBuf = buf;
    
protected voidtearDown()

        baseBuf = null;
        buf = null;
    
public voidtestWrappedCharBuffer_IllegalArg()

tests
java.nio.CharBuffer#allocate(char[],int,int)

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