Skip to content

Preserve TestSetup suite fixtures as static Jupiter lifecycle methods. - #1146

Open
motlin wants to merge 1 commit into
openrewrite:mainfrom
motlin:fix-1110-junit-testsetup-lifecycle
Open

motlin wants to merge 1 commit into
openrewrite:mainfrom
motlin:fix-1110-junit-testsetup-lifecycle

Conversation

@motlin

@motlin motlin commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What's changed?

MigrateJUnitTestCase preserves one-time fixtures from a suite() method returning an anonymous TestSetup around new TestSuite(CurrentTest.class). The decorator's setUp() and tearDown() bodies become static @BeforeAll and @AfterAll methods on the test class.

What's your motivation?

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Oct 1, 2026
@motlin
motlin force-pushed the fix-1110-junit-testsetup-lifecycle branch 2 times, most recently from 58b36b9 to f86fb2e Compare October 5, 2026 21:53
@motlin
motlin force-pushed the fix-1110-junit-testsetup-lifecycle branch from f86fb2e to dfa791d Compare October 17, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

JUnit 4 to 5 migration discards the one-time setup a TestSetup decorator performed, breaking tests at run time

1 participant