-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Bug]: junit-jupiter brings junit 4 transitvely #6934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem is also that you can't even manually exclude it. Somehow the testcontainer jupiter API indirectly references it and custom container classes can't be compiled without junit 4 being present on the classpath. The only solution I found is |
I also found this issue, it is better to upgrade Junit 5 API and support Junit 4 using Junit 5 Vintage Engine |
This is a duplicate of #6921 and should be closed. |
Root Cause
Blocked on
Workaround
cc: @eddumelendez |
the specific issue is that |
Yes, a fix would require a complete refactor from Junit4 TestRule to Junit5 AfterEachCallback and BeforeEachCallback. |
Junit 5 also supports Junit 4 Rules via VintageEngine. See the Junit documentation. |
It seems like vintage engine might provide value to testcontainers project as a transitionary point. From a client perspective it seems roughly equivalent, since the junit4 annotations are still used and you're effectively just shifting the name of the dependency artifact from |
Duplicates #970. There are a couple of stub dependencies for JUnit4 out there, that can be used as a workaround (e.g. https://github.com/xdev-software/testcontainers-junit4-mock). |
Module
Core
Testcontainers version
1.18.0
Using the latest Testcontainers version?
Yes
Host OS
MacOs
Host Arch
x86
Docker version
What happened?
Adding a dependency on
org.testcontainers:junit-jupiter:jar:1.18.0
(at least with Maven) bringsjunit:junit:jar:4.13.2
on the test classpath.Relevant log output
The text was updated successfully, but these errors were encountered: