@Test
public void testDecrypt() throws Exception {

    byte[] keyRef = "keyref".getBytes(StandardCharsets.UTF_8);
    byte[] key = "key".getBytes(StandardCharsets.UTF_8);
    byte[] clearData = "clear data".getBytes(StandardCharsets.UTF_8);
    byte[] encodedData = "encoded data".getBytes(StandardCharsets.UTF_8);
    given(keyProvider.getKey(keyRef)).willReturn(Optional.of(key));
    given(encryptionAlgorithm.decrypt(encodedData, key)).willReturn(clearData);
    byte[] res = defaultDecryptor.decrypt(encodedData, keyRef);
    assertThat(res).isEqualTo(clearData);
}