GH-42193: [Java] Update dependency to maintain JUnit 5 only#42206
Conversation
|
@vibhatha Is it sufficient to just remove the Also, I encountered an error after merging my Flight Module commit as below. However, the current machine was not used to migrate the Flight Module. The machine has a tricky environment, so I cannot be sure if the error is occurring for everyone. However, the CIs seem to be working well. [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.026 s <<< FAILURE! -- in org.apache.arrow.driver.jdbc.ITDriverJarValidation
[ERROR] org.apache.arrow.driver.jdbc.ITDriverJarValidation.validateShadedJar -- Time elapsed: 0.011 s <<< FAILURE!
org.opentest4j.AssertionFailedError: jar ==> expected: <Driver jar was not detected in the classpath> but was: <jar>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
at org.apache.arrow.driver.jdbc.ITDriverJarValidation.getJdbcJarFile(ITDriverJarValidation.java:72)
at org.apache.arrow.driver.jdbc.ITDriverJarValidation.validateShadedJar(ITDriverJarValidation.java:84)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] ITDriverJarValidation.validateShadedJar:84->getJdbcJarFile:72 jar ==> expected: <Driver jar was not detected in the classpath> but was: <jar>
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 |
|
I also got the same error locally when I was testing some other feature. We may need to take a look. Could you file an issue? |
|
Also I am not sure if that would be the only dependency. Can we try intellisense and see if we still get the Junit4? |
We can check the dependencies using There are no JUnit 4.x dependencies. So, I believe there is no need for further checks. I attached result. mvn dependency:tree | grep junit
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.10.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:2.25.1:test |
That's right. The issue appears intermittently. I'll summarize the details and create an issue. |
|
I believe we have a way to configure disallowed dependencies for a stronger check |
|
Ah, the root POM has maven-enforcer-plugin which can ban junit4 entirely |
I took a look, we already listed a few such dependencies. That's perfect. Let's use that. |
There was a problem hiding this comment.
I updated it. Thank you for review!
|
@github-actions crossbow submit -g java |
|
Revision: be5e51a73ec8e3aef318a4a3c85fe892d3a9ad26 Submitted crossbow builds: ursacomputing/crossbow @ actions-cc74f066f5 |
I created issue for comment |
|
just making sure java-jars passes now |
|
Did we re-run? |
|
@vibhatha can someone take a look at the issue? I don't think this will go away on re-run |
|
That was rebased about two hours ago. Perhaps we could try running it again? |
|
@github-actions crossbow submit java-jars |
|
Revision: f41f9b7285b189060e90fcd870d9608fec9cbe54 Submitted crossbow builds: ursacomputing/crossbow @ actions-5074156199
|
|
@llama90 if you want to rebase here I can re-run Crossbow |
|
@lidavidm Done! |
|
@github-actions crossbow submit -g java |
|
Revision: 4db3a9f Submitted crossbow builds: ursacomputing/crossbow @ actions-4efa92c4b0 |
|
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit f07d442. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 10 possible false positives for unstable benchmarks that are known to sometimes produce them. |
…ache#42206) ### Rationale for this change We have completed migrating all unit test code from JUnit 4 to JUnit 5 for all Java modules. Now, we are removing the compatibility library `junit-vintage-engine` to maintain JUnit 5 only. ### What changes are included in this PR? - Removing JUnit 4 dependencies - Updating remaining `junit.framework.TestCase` imports - Updating excludes to prevent JUnit 4 dependencies ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: apache#42193 Authored-by: Hyunseok Seo <hsseo0501@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
Rationale for this change
We have completed migrating all unit test code from JUnit 4 to JUnit 5 for all Java modules. Now, we are removing the compatibility library
junit-vintage-engineto maintain JUnit 5 only.What changes are included in this PR?
junit.framework.TestCaseimportsAre these changes tested?
Yes.
Are there any user-facing changes?
No.