From 5511255080988ca50ab5fece53b5a40084cd8561 Mon Sep 17 00:00:00 2001 From: Falko Modler Date: Sat, 26 Feb 2022 00:13:12 +0100 Subject: [PATCH] Prevent NoSuchElementException in MockSupport after earlier error --- .../src/main/java/io/quarkus/test/junit/MockSupport.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/MockSupport.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/MockSupport.java index 4707a1b63dcba..1ced5c1988d5e 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/MockSupport.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/MockSupport.java @@ -18,6 +18,9 @@ static void pushContext() { } static void popContext() { + if (contexts.isEmpty()) { + return; // can happen on error in QuarkusTestResourceLifecycleManagers etc. + } List val = contexts.pop(); for (Object i : val) { try {