@Test
public void verifyLookupEnforcerRevealsException() throws ExecutionException, InterruptedException {

    final DittoRuntimeException expectedException =
            DittoRuntimeException.newBuilder("this should be happening", HttpStatusCode.HTTPVERSION_NOT_SUPPORTED)
                    .build();
    final EntityIdWithResourceType entityId = EntityIdWithResourceType.of("any", DefaultEntityId.of("id"));
    when(enforcerCache.get(any(EntityIdWithResourceType.class))).thenReturn(
            CompletableFuture.completedFuture(Optional.of(Entry.nonexistent())));
    final CompletionStage<Contextual<WithDittoHeaders>> result = retriever.retrieveByEnforcerKey(entityId, enforcerEntry -> {
        throw expectedException;
    });
    verify(enforcerCache).get(entityId);
    verifyException(result, expectedException);
}