Failure (@NotNull org.gradle.tooling.Failure failure) { var message = failure.getMessage(); var description = failure.getDescription(); var causes = ContainerUtil.map(failure.getCauses(), it -> convertTestFailure(it)); if (failure instanceof FileComparisonTestAssertionFailure comparisonFailure) { var exceptionName = comparisonFailure.getClassName(); var stackTrace = comparisonFailure.getStacktrace(); var expectedContent = comparisonFailure.getExpectedContent(); var actualContent = comparisonFailure.getActualContent(); var expectedText = ObjectUtils.doIfNotNull(expectedContent, it -> new String(it, FILE_COMPARISON_CONTENT_CHARSET)); var actualText = ObjectUtils.doIfNotNull(actualContent, it -> new String(it, FILE_COMPARISON_CONTENT_CHARSET)); var expectedFile = comparisonFailure.getExpected(); var actualFile = comparisonFailure.getActual(); if (expectedText != null && actualText != null) { return new TestAssertionFailure(exceptionName, message, stackTrace, description, causes, expectedText, actualText, expectedFile, actualFile); } } if (failure instanceof org.gradle.tooling.TestAssertionFailure assertionFailure) { var exceptionName = assertionFailure.getClassName(); var stackTrace = assertionFailure.getStacktrace(); var expectedText = assertionFailure.getExpected(); var actualText = assertionFailure.getActual(); if (expectedText != null && actualText != null) { return new TestAssertionFailure(exceptionName, message, stackTrace, description, causes, expectedText, actualText); } } if (failure instanceof org.gradle.tooling.TestFailure testFailure) { var exceptionName = testFailure.getClassName(); var stackTrace = testFailure.getStacktrace(); return new TestFailure(exceptionName, message, stackTrace, description, causes, false); } LOG.warn("Undefined test failure type " + failure.getClass().getName()); return new FailureImpl(message, description, Collections.emptyList()); }