From 18647c24ca136bd8713d1b9407bca9d61e36bb24 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 17 Oct 2024 22:07:37 +0200 Subject: [PATCH] [sinttest] Perform early exit in JulTestRunResultProcessor.process() --- .../SmackIntegrationTestFramework.java | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java index 742a4898d..6c322c2e7 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java @@ -150,27 +150,28 @@ public class SmackIntegrationTestFramework { LOGGER.info("SmackIntegrationTestFramework[" + testRunResult.testRunId + ']' + " finished: " + successfulTests + '/' + availableTests + " [" + failedTests + " failed]"); - if (failedTests > 0) { - StringBuilder sb = new StringBuilder("💀 The following " + failedTests + " tests failed! 💀\n -"); - StringUtils.appendTo(testRunResult.failedIntegrationTests, "\n- ", sb, t -> sb.append(t.concreteTest)); - LOGGER.warning(sb.toString()); + if (failedTests == 0) { + LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/"); + return; + } - final SortedSet bySpecification = new TreeSet<>(); - for (FailedTest failedTest : testRunResult.failedIntegrationTests) { - final Throwable cause = failedTest.failureReason; - LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause); - if (failedTest.concreteTest.method.getDeclaringClass().isAnnotationPresent(SpecificationReference.class)) { - final String specificationReference = getSpecificationReference(failedTest.concreteTest.method); - if (specificationReference != null) { - bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')"); - } + StringBuilder sb = new StringBuilder("💀 The following " + failedTests + " tests failed! 💀\n -"); + StringUtils.appendTo(testRunResult.failedIntegrationTests, "\n- ", sb, t -> sb.append(t.concreteTest)); + LOGGER.warning(sb.toString()); + + final SortedSet bySpecification = new TreeSet<>(); + for (FailedTest failedTest : testRunResult.failedIntegrationTests) { + final Throwable cause = failedTest.failureReason; + LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause); + if (failedTest.concreteTest.method.getDeclaringClass().isAnnotationPresent(SpecificationReference.class)) { + final String specificationReference = getSpecificationReference(failedTest.concreteTest.method); + if (specificationReference != null) { + bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')"); } } - if (!bySpecification.isEmpty()) { - LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification)); - } - } else { - LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/"); + } + if (!bySpecification.isEmpty()) { + LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification)); } } }