@Override
    public void onError(Throwable t) {
        forwardErrorToLeaderContender(t);
    }
@Test
    void testErrorIsIgnoredAfterLeaderElectionBeingClosed() throws Exception {
        new Context() {
            {
                runTestWithSynchronousEventHandling(
                        () -> {
                            closeLeaderElectionInBothContexts();

                            final Exception testException = new Exception("test leader exception");

                            leaderElectionService.onError(testException);

                            applyToBothContenderContexts(
                                    ctx ->
                                            assertThat(ctx.contender.getError())
                                                    .as("No error should have been forwarded.")
                                                    .isNull());

                            assertThat(
                                            fatalErrorHandlerExtension
                                                    .getTestingFatalErrorHandler()
                                                    .getException())
                                    .as(
                                            "The fallback error handler should have caught the error in this case.")
                                    .isEqualTo(testException);

                            fatalErrorHandlerExtension.getTestingFatalErrorHandler().clearError();
                        });
            }
        };
    }