Skip to content

Commit 39b563d

Browse files
committed
Add more helpful error message for unfixable problem.
1 parent 01b7e87 commit 39b563d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractJvmQuarkusTestExtension.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,20 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con
160160
.unwrap(SmallRyeConfig.class)
161161
.getConfigMapping(TestConfig.class);
162162
} catch (Exception | ServiceConfigurationError e) {
163-
// Tracked by https://github.com/quarkusio/quarkus/issues/46048
164-
Log.error("Could not read configuration while evaluating whether to run " + context.getRequiredTestClass()
165-
+ ". This usually happens when re-running a test that has already failed, for example if surefire.rerunFailingTestsCount is set. To work around this limitation, either adjust the test so that it passes, or isolate the test into a project whose tests all use the same combination of @TestProfile and resources.");
163+
boolean isEclipse = System.getProperty("sun.java.command") != null
164+
&& System.getProperty("sun.java.command").contains("JUnit5TestLoader");
165+
if (isEclipse) {
166+
// Tracked by https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2257
167+
Log.error(
168+
"Could not read configuration while evaluating whether to run a test. This is a known issue when running tests in the Eclipse IDE. To work around the problem, edit the run configuration and add `-uniqueId [engine:junit-jupiter]/[class:"
169+
+ context.getRequiredTestClass().getName()
170+
+ "]` in the program arguments. Running the whole package, or running individual test methods, will also work without any extra configuration.");
171+
} else {
172+
Log.error("Internal error: Could not read configuration while evaluating whether to run "
173+
+ context.getRequiredTestClass()
174+
+ ". Please let the Quarkus team know what you were doing when this error happened.");
175+
176+
}
166177
Log.debug("Underlying exception: " + e);
167178
Log.debug("Thread Context Classloader: " + Thread.currentThread().getContextClassLoader());
168179
Log.debug("The class of the class we use for mapping is " + TestConfig.class.getClassLoader());

0 commit comments

Comments
 (0)