protected void runWithSubject(Subject subject, SubjectConsumer consumer) {
        Exception exception = subject.execute(() -> {
            try {
                consumer.accept(subject);
                return null;
            } catch (Exception e) {
                return e;
            }
        });
        if (Objects.nonNull(exception)) {
            throw new RuntimeException("Test execution threw exception", exception);
        }
    }
Associates the {@code consumer} with the {@code subject} and executes. If an exeception was thrown by the
consumer, it is re-thrown by this method.

@param subject  The subject to bind to the current thread.
@param consumer The block of code to run under the context of the subject.
@throws Exception propagates any exception thrown by the consumer.
core/src/test/java/org/apache/shiro/test/SecurityManagerTestSupport.java