Base64Codec { public final static byte[] decode(byte[] sArr) throws DecodeException { return decode(sArr, 0, sArr.length); }  final static byte[] encodeToByte(byte[] sArr, boolean lineSep); final static byte[] encodeToByte(byte[] sArr, int sOff, int sLen, boolean lineSep); final static byte[] decode(byte[] sArr); final static byte[] decode(byte[] sArr, int sOff, int sLen); final static byte[] decodeFast(byte[] sArr, int sLen);  }
@Test public void testDecode() throws DecodeException { assertArrayEquals(PLAIN, Base64Codec.decode(ENCODED)); }
@Test public void testDecodeIllegal() throws DecodeException { byte[] illegal = "%$%".getBytes(UTF8); byte[] merged = concat(ENCODED, concat(illegal, ENCODED)); assertFalse(concat(PLAIN, PLAIN).length == Base64Codec.decode(merged).length); }
@Test public void testDecodeIllegalLeading() throws DecodeException { byte[] leading = "%$%".getBytes(UTF8); byte[] merged = concat(leading, ENCODED); assertArrayEquals(PLAIN, Base64Codec.decode(merged)); }
@Test public void testDecodeIllegalTrailing() throws DecodeException { byte[] trailing = "%$%".getBytes(UTF8); byte[] merged = concat(ENCODED, trailing); assertArrayEquals(PLAIN, Base64Codec.decode(merged)); }
@Test(expected=DecodeException.class) public void testDecodeInvalidLength() throws DecodeException { Base64Codec.decode(ENCODED, 0, ENCODED.length + 1); }
@Test public void testDecodeFastIllegal() throws DecodeException { byte[] illegal = "%$%".getBytes(UTF8); byte[] merged = concat(ENCODED, concat(illegal, ENCODED)); assertFalse(concat(PLAIN, PLAIN).length == Base64Codec.decode(merged).length); }