### Question:
EncryptionService { public byte[] encryptData(byte[] data) { try { Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, getAesKey()); return cipher.doFinal(data); } catch (NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchPaddingException ex) { throw new SecurityException(ex); } } EncryptionService(); byte[] encryptData(byte[] data); byte[] decryptData(byte[] encryptedData); Key getAesKey();  }### Answer:
@Test public void encryptData() throws NoSuchFieldException, IllegalAccessException { final String base64Encoded = "hfZcGLKmy9Q9iPRR+3XfmV7TzHoYU+6NKvJk4gSZfI0="; EncryptionService cut = new EncryptionService(); cut.encryptionKey = createEncryptionKey("01234567890123456789012345678912"); final Charset charset = Charset.forName("UTF-8"); final byte[] bytes = cut.encryptData("test@example.com".getBytes(charset)); assertThat(new String(Base64.getEncoder().encode(bytes)), CoreMatchers.is(base64Encoded)); final EncryptionService encryptionService = getEncryptedFieldConverter().getEncryptionService(); final Field encryptionKeyField = encryptionService.getClass().getDeclaredField("encryptionKey"); encryptionKeyField.setAccessible(true); encryptionKeyField.set(encryptionService, cut.encryptionKey); TestPlayer testPlayer = new TestPlayer(); testPlayer.setEmail("test@example.com"); getDatastore().save(testPlayer); final List<Player> foundPlayerList = getDatastore().find(Player.class).field("email").equal(new EncryptedFieldValueWrapper("test@example.com")).asList(); assertThat(foundPlayerList.size(), CoreMatchers.is(1)); }