@Override
    public boolean authorize(P principal, String role, @Nullable ContainerRequestContext requestContext) {
        try (Timer.Context context = getsTimer.time()) {
            final AuthorizationContext<P> cacheKey = getAuthorizationContext(principal, role, requestContext);
            return Boolean.TRUE.equals(cache.get(cacheKey));
        } catch (CompletionException e) {
            Throwable cause = e.getCause();
            if (cause instanceof RuntimeException) {
                throw (RuntimeException) cause;
            }
            if (cause instanceof Error) {
                throw (Error) cause;
            }
            throw e;
        }
    }
@Test
    void shouldPropagateRuntimeException() {
        final RuntimeException e = new NullPointerException();
        when(underlying.authorize(principal, role, requestContext)).thenThrow(e);
        assertThatNullPointerException()
            .isThrownBy(() -> cached.authorize(principal, role, requestContext))
            .isSameAs(e);
    }