Closed vlsi closed 10 months ago
JUnit4 is in maintenance mode, so it is hard to predict when or if this might be addressed.
According to the Migrating from JUnit 4 JUnit Jupiter supports AssumptionViolatedException
; have you tried having assumeHaveMinimumServerVersion()
use org.junit.Assume
?
@kcooney , thanks for the comment, however, I want to migrate to JUnit5 fully, so I would like to refrain from mixing different Assume
calls in the test code.
@kcooney , thanks for the comment, however, I want to migrate to JUnit5 fully, so I would like to refrain from mixing different
Assume
calls in the test code.
Couldn't you have the Assume
calls in your shared test code be the last code you migrate? It sounds like this issue only affects you mid-migration.
Note that multiple runners and rules have logic for AssumptionViolatedException
so even if the core JUnit code was updated to support TestAbortedException
we could not guarantee that third party rules or runners would work.
I went with excluding TestUtil
from openrewrite processing (so it will use JUnit4's Assumption), and I will remove the exclusions as I manually migrate the remaining JUnit4 tests to JUnit5. I guess this can be closed as I do not need the change anymore.
Imagine the project migrates from JUnit4 to JUnit5. They might have a helper method executing
assumeTrue
. However, if the project migrates toorg.junit.jupiter.api .Assumptions.assumeTrue
the error flips toorg.opentest4j.TestAbortedException
so the test no longer works. I guess the reason is junit4 does not recognizeTestAbortedException
and it treats the error as the regular test failure.I am running
junit:junit:4.13.2
test withorg.junit.vintage:junit-vintage-engine:5.9.3
Here's a sample failure:
https://github.com/pgjdbc/pgjdbc/actions/runs/6795875259/job/18474816613?pr=2979#step:8:450