Skip to content

Commit 57adab5

Browse files
marko-bekhtayrodiere
authored andcommitted
HHH-19832 Wrap the discover step in a try catch
to give more information to the user on possible reasons why the discovery failed.
1 parent 18af003 commit 57adab5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedTestEngine.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.junit.jupiter.api.TestInstance;
3232
import org.junit.jupiter.api.extension.ExecutionCondition;
3333
import org.junit.jupiter.api.extension.Extension;
34+
import org.junit.jupiter.api.extension.ExtensionConfigurationException;
3435
import org.junit.jupiter.api.extension.ExtensionContext;
3536
import org.junit.jupiter.api.extension.TestInstantiationAwareExtension;
3637
import org.junit.jupiter.api.io.CleanupMode;
@@ -72,7 +73,17 @@ public String getId() {
7273
@Override
7374
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
7475
if ( isEnabled() ) {
75-
return doDiscover( discoveryRequest, uniqueId );
76+
try {
77+
return doDiscover( discoveryRequest, uniqueId );
78+
}
79+
catch (OutOfMemoryError e) {
80+
throw e;
81+
}
82+
catch (Error e) {
83+
throw new ExtensionConfigurationException(
84+
"Encountered a problem when enhancing the test classes. It is highly likely that @BytecodeEnhanced extension is incompatible with the provided version of JUnit.",
85+
e );
86+
}
7687
}
7788

7889
return new EngineDescriptor( uniqueId, getId() );

0 commit comments

Comments
 (0)