From 2a46b633359b91f4209d0de2889b98182dba6fe1 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 12 Apr 2021 13:13:30 +0200 Subject: [PATCH] Avoid unnecessary exception wrapping in NativeTestExtension.throwBootFailureException --- .../java/io/quarkus/test/junit/NativeTestExtension.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/NativeTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/NativeTestExtension.java index 9e9e2419b606c..ef39d9b91381f 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/NativeTestExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/NativeTestExtension.java @@ -151,10 +151,15 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext contex } } - private void throwBootFailureException() { + private void throwBootFailureException() throws Exception { if (firstException != null) { Throwable throwable = firstException; firstException = null; + + if (throwable instanceof Exception) { + throw (Exception) throwable; + } + throw new RuntimeException(throwable); } else { throw new TestAbortedException("Boot failed");