Skip to content

Moves Junit 4 support from core to separate module #5826

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

Closed
wants to merge 1 commit into from

Conversation

froque
Copy link
Contributor

@froque froque commented Sep 6, 2022

Module is named testcontainers-junit4 (as suggested in #737) instead of junit4 because it fails when building examples with
"> Module version 'org.testcontainers:junit4' is not unique in composite: can be provided by [project :testcontainers-java:docs:examples:junit4, project "

Seems related to gradle/gradle#12872

Fixes #970 and #87 (duplicates #2826, #3101, #3374, #3548, #3737, #3753, #3756, #5287, #5404, #1525)

This is a breaking change and should target future testcontainers-2.0.

Could not find any branch for future 2.0 so this pull request is targeting master.

I started working on a openrewrite recipe to acompany this pull request but is not yet presentable.

Module is named testcontainers-junit4 instead of junit4 because it fails
when building examples with
"> Module version 'org.testcontainers:junit4' is not unique in composite: can be provided by [project :testcontainers-java:docs:examples:junit4, project "

Seems related to gradle/gradle#12872
@eddumelendez
Copy link
Member

Thanks for the PR, @froque ! It has been decided to create a brand new API (JUnit-free) instead of removing junit4 integration from GenericContainer, DockerComposeContainer and Network. The main reason is do not impact those users still using JUnit 4. Introducing the new API, will allow to use it without depending on JUnit 4 and at the same time users can migrate on their own. Once we have it, this PR can be revisited and introduce a junit4 module. In the meantime, I'll close it.

@froque
Copy link
Contributor Author

froque commented Apr 12, 2023

@eddumelendez any way to help and speed this up ?

@eldarj
Copy link

eldarj commented Nov 24, 2023

@eddumelendez Any estimates or ways to speed up the development? Issues such as #970 date back to 2018. It's a bit funny that this junit 4/5 issue is present for years now and we've yet to see any practical outcome.

@nmwael
Copy link

nmwael commented Jun 14, 2024

Thanks for the PR, @froque ! It has been decided to create a brand new API (JUnit-free) instead of removing junit4 integration from GenericContainer, DockerComposeContainer and Network. The main reason is do not impact those users still using JUnit 4. Introducing the new API, will allow to use it without depending on JUnit 4 and at the same time users can migrate on their own. Once we have it, this PR can be revisited and introduce a junit4 module. In the meantime, I'll close it.

Hi, just ran latest openrewrite recipies
<recipe>org.openrewrite.java.testing.testcontainers.TestContainersBestPractices</recipe> <recipe>org.openrewrite.java.spring.boot3.SpringBoot3BestPractices</recipe>

which ended up giving
cannot access org.junit.rules.TestRule

caused by (GenericContainer<SELF extends GenericContainer)
org.testcontainers.containers

How are the

decoupling going?

regards

@nmwael
Copy link

nmwael commented Jun 17, 2024

After manually adding the junit 4 dependency, it seems like the issue have disappared after upgrading to a newer version of testcontainers / spring boot test containers.. So I am expecting my issue to be cause by an intermediate upgrade issue. And not reflecting current state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment