public void testExceptions() {
        try {
            WFBase64.decode((byte[])null, 0, 0);
            fail("Should have thrown NPE!");
        }
        catch (NullPointerException e) {
            //ok
        }
        
        try {   
            WFBase64.decode("Zm9vYmFy".getBytes(), -1, 8);
            fail("Should have failed, offset < 0");
        }
        catch (IndexOutOfBoundsException e) {
            //ok
        }
        
        try {    
            WFBase64.decode("Zm9vYmFy".getBytes(), 9, 8);
            fail("Should have failed, offset > array length");
        }
        catch (IndexOutOfBoundsException e) {
            //ok
        }
        
        try {
            WFBase64.decode("Zm9vYmFy".getBytes(),  -1, -1);
            fail("Should have failed, offset + len < 0 and len < 0");
        }
        catch (IndexOutOfBoundsException e) {
            //ok
        }
        
        try {
            WFBase64.decode("Zm9vYmFy".getBytes(), 5, 8);
            fail("Should have failed, offset + len > array legth");
        }
        catch (IndexOutOfBoundsException e) {
            //ok
        }
        
        try {
            byte[] result = new byte[5];
            WFBase64.decodeTo("Zm9vYmFy".getBytes(), 0, 8, result, 0, 5);
            fail("Should have failed, the destination buffer cannot fit the decoded data");
        }
        catch (ArrayStoreException e) {
            //ok
        }
    }