class Base64 {

    public static String encode(byte[] data) {
        if (encoderMethod == null) throw new UnsupportedOperationException("Cannot find Base64 encoder.");
        try {
            return (String) encoderMethod.invoke(encoderObject, data);
        } catch (Exception e) {
            throw new UnsupportedOperationException(e);
        }
    }

}

class Base64Test {

    @Test
    public void testEncode() {

        String input = "Hello World!";
        String result = Base64.encode(input.getBytes());
        assertEquals("SGVsbG8gV29ybGQh", result);
    }

}