MD5EncryptAlgorithm implements EncryptAlgorithm { @Override public String encrypt(final Object plaintext) { if (null == plaintext) { return null; } return DigestUtils.md5Hex(String.valueOf(plaintext)); }  @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("098f6bcd4621d373cade4e832627b4f6")); }
@Test public void assertEncryptWithNullPlaintext() { assertNull(encryptAlgorithm.encrypt(null)); }