Base64 implements ICodec { @Override public byte[] encode(@Nonnull final byte[] message) throws EncodingException { try { return base64Encoder.encode(message); } catch (Exception e) { throw new EncodingException("Base64 encoding has been failed because: " + e.getMessage(), e); } } private  Base64(); static Base64 create(); @Override byte[] encode(@Nonnull final byte[] message); @Override byte[] decode(@Nonnull final byte[] message);  }
@Test public void encodeBase64Test() throws EncodingException { byte[] base64EncodeResult = base64.encode(SOURCE_MSG); assertTrue(Arrays.equals(base64EncodeResult, BASE64_MSG)); }