summaryrefslogtreecommitdiffstats
path: root/vespa-osgi-testrunner
diff options
context:
space:
mode:
Diffstat (limited to 'vespa-osgi-testrunner')
-rw-r--r--vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java16
-rw-r--r--vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestReport.java4
2 files changed, 9 insertions, 11 deletions
diff --git a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java
index 6fd3400d41d..06a4680e982 100644
--- a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java
+++ b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/JunitRunner.java
@@ -156,16 +156,12 @@ public class JunitRunner extends AbstractComponent implements TestRunner {
static TestRunner.Status testRunnerStatus(TestReport report) {
if (report == null) return Status.NO_TESTS;
- switch (report.root().status()) {
- case error:
- case failed: return Status.FAILURE;
- case inconclusive: return Status.INCONCLUSIVE;
- case successful:
- case skipped:
- case aborted: return report.root().tally().containsKey(TestReport.Status.successful) ? Status.SUCCESS
- : Status.NO_TESTS;
- default: throw new IllegalStateException("unknown status '" + report.root().status() + "'");
- }
+ return switch (report.root().status()) {
+ case error, failed -> Status.FAILURE;
+ case inconclusive -> Status.INCONCLUSIVE;
+ case successful, skipped, aborted -> report.root().tally().containsKey(TestReport.Status.successful) ? Status.SUCCESS
+ : Status.NO_TESTS;
+ };
}
@Override
diff --git a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestReport.java b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestReport.java
index e967ddd8abe..2e74d2c2b3a 100644
--- a/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestReport.java
+++ b/vespa-osgi-testrunner/src/main/java/com/yahoo/vespa/testrunner/TestReport.java
@@ -20,6 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
+import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@@ -52,7 +53,8 @@ public class TestReport {
}
static TestReport createFailed(Clock clock, Suite suite, Throwable thrown) {
- if (thrown instanceof OutOfMemoryError) throw (Error) thrown;
+ if (thrown instanceof OutOfMemoryError oome) throw oome;
+ if (thrown instanceof ExecutionException ee) thrown = ee.getCause();
TestReport failed = new TestReport(clock, suite, Set.of());
failed.complete();
failed.root().children.add(new FailureNode(failed.root(), clock.instant(), thrown, suite, Set.of()));