Base64 { public final static String encodeToString(byte[] sArr, boolean lineSep) { return new String(encodeToChar(sArr, lineSep)); }  final static char[] encodeToChar(byte[] sArr, boolean lineSep); final static byte[] decode(char[] sArr); final static byte[] decodeFast(char[] sArr); 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); final static String encodeToString(byte[] sArr, boolean lineSep); final static byte[] decode(String str); final static byte[] decodeFast(String s);  }
@Test public void testDecodeBase64_url() throws Exception { for (byte[] sample : randomSamples) { String input = Base64.getUrlEncoder().encodeToString(sample); assertArrayEquals(sample, decodeBase64(input)); } }
@Test public void testDecodeBase64_url_noPadding() throws Exception { for (byte[] sample : randomSamples) { String input = Base64.getUrlEncoder().encodeToString(sample).replaceAll("=", ""); assertArrayEquals(sample, decodeBase64(input)); } }
@Test public void testDecodeBase64() throws Exception { for (byte[] sample : randomSamples) { String input = Base64.getEncoder().encodeToString(sample); assertArrayEquals(sample, decodeBase64(input)); } }
@Test public void testDecodeBase64_noPadding() throws Exception { for (byte[] sample : randomSamples) { String input = Base64.getEncoder().encodeToString(sample).replaceAll("=", ""); assertArrayEquals(sample, decodeBase64(input)); } }