void (Failure failure, RunNotifier notifier) { var testDescription = failure.getDescription(); if (testDescription == Description.EMPTY || testDescription == Description.TEST_MECHANISM || !testDescription.isTest()) { return; } var testClass = testDescription.getTestClass(); if (testClass == null) { throw new IllegalStateException("No test class for " + testDescription.getDisplayName()); } if (TestCase.class.isAssignableFrom(testClass) && "warning".equals(testDescription.getMethodName()) || TestCaseLoader.isPerformanceTest(null, testClass.getSimpleName())) { return; } var runner = Request.classWithoutSuiteMethod(testClass).filterWith(testDescription).getRunner(); var failureExposingListener = new RetryListener(); notifier.addFirstListener(failureExposingListener); retryTest(testDescription.getDisplayName(), () -> { failureExposingListener.failure = null; runner.run(notifier); if (failureExposingListener.failure != null) { throw failureExposingListener.failure.getException(); } }); notifier.removeListener(failureExposingListener); }