Codecs { public static Base64 createStandardBase64() { try { return Base64.class.getConstructor(int.class).newInstance(0); } catch (SecurityException e) { } catch (NoSuchMethodException e) { } catch (IllegalArgumentException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } return new Base64(); } private  Codecs(); static Base64 createStandardBase64();  }
@Test public void testcreateStandardBase64() { String quote = "Man is distinguished, not only by his reason, but " + "by this singular passion from other animals, which is a" + " lust of the mind, that by a perseverance of delight in" + " the continued and indefatigable generation of knowledge," + " exceeds the short vehemence of any carnal pleasure."; String expected = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpc" + "yByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSB" + "vdGhlci" + "BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYn" + "kgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu" + "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xl" + "ZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5" + "hbCBwbGVhc3VyZS4="; assertArrayEquals(Codecs.createStandardBase64().encode(quote.getBytes()), expected.getBytes()); }