@Override
    public synchronized RuntimeException handleFault(String failureMessage, Throwable cause) {
        if (cause == null) {
            log.error("Encountered {} fault: {}", name, failureMessage);
        } else {
            log.error("Encountered {} fault: {}", name, failureMessage, cause);
        }
        FaultHandlerException e = (cause == null) ?
                new FaultHandlerException(name + ": " + failureMessage) :
                new FaultHandlerException(name + ": " + failureMessage +
                        ": " + cause.getMessage(), cause);
        if (firstException == null) {
            firstException = e;
        }
        return firstException;
    }
This is a fault handler suitable for use in JUnit tests. It will store the result of the first
call to handleFault that was made.
server-common/src/test/java/org/apache/kafka/server/fault/MockFaultHandler.java