Skip to content

Remove dependency to Junit4 #775

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
fabapp2 opened this issue Apr 26, 2023 · 6 comments · Fixed by #777
Closed

Remove dependency to Junit4 #775

fabapp2 opened this issue Apr 26, 2023 · 6 comments · Fixed by #777
Labels
good first issue Good for newcomers type: enhancement New feature or request
Milestone

Comments

@fabapp2
Copy link
Contributor

fabapp2 commented Apr 26, 2023

What needs to be done

Remove JUnit4 from classpath

Why it needs to be done

Some dependency pulls in JUnit 4.
We use JUnit 5 and having both in the classpath could lead to wrong annotations being used, e.g. @Test.

Acceptance Criteria

a mvn dependency:tree should not contain any junit:junit:4.x dependency

@fabapp2 fabapp2 added type: enhancement New feature or request good first issue Good for newcomers labels Apr 26, 2023
@Rayan1605
Copy link

I can do this if you wish

@nikhilyedke1995
Copy link

Hi, Can I work on this? I'm a first time contributor.

@szymonsadowski3
Copy link
Contributor

szymonsadowski3 commented Apr 27, 2023

This may not be straightforward to achieve, since the junit4 comes from testcontainers, where it has been an issue for a long time (issue linked at the bottom):

obraz

See the relevant issue in testcontainers project: testcontainers/testcontainers-java#970. There are some workarounds mentioned though, may be worth to try them out

@fabapp2
Copy link
Contributor Author

fabapp2 commented Apr 27, 2023

Hello everyone!
first of all, I am happy and grateful for the great interest to contribute and your fast replies to this issue 🤩

@szymonsadowski3 thanks for pointing this out. It seems indeed harder than I thought.
I was hoping JUnit 4 slipped in recently somehow (we had pain after accidentally using wrong @Test annotation yesterday).

It seems not to be as straightforward as just excluding a transitive dependency.
@Rayan1605 you asked first if you want to pick this and see if you can get it done - more than happy.
If not @nikhilyedke1995 can give it a try, otherwise we live with JUnit 4 for now, I guess...

I plan to clean up the backlog soon and create/find new issues that are (hopefully) a good start.
@nikhilyedke1995 keep an eye on it, please.

@szymonsadowski3
Copy link
Contributor

szymonsadowski3 commented Apr 27, 2023

@fabapp2 Really sorry if I step out of line here, but since I had the setup on my local and researched the issue already I took the liberty of opening a PR for this: #777

The workaround provided in the issue that I linked seems to be working fine based on my local testing (additionally I had to adjust fail assertion of IntegrationTestBaseClass as well, since it was using junit4 fail assertion).

If this is turns out to be indeed a working solution, a further improvement would be to ban the use of junit4 using enforcer plugin (idea from https://stackoverflow.com/questions/61629824/preventing-the-use-of-junit4-libraries-in-a-pro) which maybe our friends @Rayan1605 and @nikhilyedke1995 can take a look at :)

@fabapp2 fabapp2 linked a pull request Apr 27, 2023 that will close this issue
@fabapp2
Copy link
Contributor Author

fabapp2 commented Apr 27, 2023

You've been fast @szymonsadowski3 🏎️
Nice idea of using the enforce plugin. @Rayan1605 @nikhilyedke1995 ?

fixed with #777

@fabapp2 fabapp2 closed this as completed Apr 27, 2023
@fabapp2 fabapp2 added this to the v0.14.0 milestone Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants