@Test
public void matchesCanary_shouldThrowIncorrectKeyException_IfExceptionIsThrown() throws Exception {

  when(encryptionProvider.decrypt(any(), any(), any())).thenThrow(new Exception("something bad happened"));
  subject = new ExternalKeyProxy(encryptionKeyMetadata, encryptionProvider);
  try {
    subject.matchesCanary(encryptionKeyCanary);
    fail("Expected IncorrectKeyException, got none");
  } catch (final IncorrectKeyException e) {
  } catch (final RuntimeException e) {
    fail("Wrong exception. Expected IncorrectKeyException but got " + e.getClass().toString());
  }
}