RC4EncryptAlgorithm implements EncryptAlgorithm { @Override public String encrypt(final Object plaintext) { if (null == plaintext) { return null; } byte[] result = handle(StringUtils.getBytesUtf8(String.valueOf(plaintext)), key); return Base64.encodeBase64String(result); }  @Override void init(); @Override String encrypt(final Object plaintext); @Override Object decrypt(final String ciphertext); @Override String getType();  }
@Test public void assertEncode() { assertThat(encryptAlgorithm.encrypt("test"), is("qn36NQ==")); }
@Test public void assertEncryptWithNullPlaintext() { assertNull(encryptAlgorithm.encrypt(null)); }