CipherCodec implements Codec { @Override public String encode(String value) throws SQLException { try { Cipher cipher = Cipher.getInstance(this.key.getAlgorithm()); cipher.init(Cipher.ENCRYPT_MODE, this.key); return Base64.getEncoder().encodeToString(cipher.doFinal(value.getBytes())); } catch (GeneralSecurityException e) { throw new SQLException(e); } } CipherCodec(Key key); Key getKey(); @Override String decode(String value); @Override String encode(String value);  }
@Test public void encode() throws SQLException { Assert.assertEquals(ENCODED, this.codec.encode(PASSWORD)); }