source: class DefaultEncryptorTest {
  
      @Mock KeyProvider keyProvider;
      @Mock CryptoAlgorithm encryptionAlgorithm;
      @InjectMocks DefaultEncryptor defaultEncryptor;
  
      @Test
      public void testEncrypt() throws Exception {
  
target:         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.encrypt(clearData, key)).willReturn(encodedData);
  
          byte[] res = defaultEncryptor.encrypt(clearData, keyRef);
  
          assertThat(res).isEqualTo(encodedData);
      }
  
  }