Skip to main content

Recommended rollout order

When upgrading testing practices across multiple projects, the order matters. Each step produces a focused, reviewable set of changes. Run them one at a time, review the diff, and merge before proceeding to the next step.

Step-by-step sequence

StepRecipe / ActionWhy this order?
1Change test method signaturesSmall, safe changes (remove public, remove test prefix). Easy to review and merge. Reduces noise in subsequent diffs.
2Migrate JUnit 4 to JUnit 5Updates annotations and imports. Best done after signature cleanup so the diff is focused on the framework migration.
3Adopt AssertJConverts JUnit/Hamcrest assertions to AssertJ. This is the largest diff -- keeping it separate from the JUnit migration makes review manageable.
4Upgrade to JUnit 6Requires Java 17+. Only run this once your project is already on JUnit 5.
5Upgrade test code to Java 21Adopts text blocks, SequencedCollection, etc. in test code only. A safe way to start using modern Java before upgrading production code.
tip

For a large portfolio (50+ repos), steps 1-3 deliver the highest impact. Steps 4-5 can wait until the team is comfortable with the new patterns.

Each step takes roughly 5-15 minutes per repository: run the recipe, review the diff, run the tests, and merge.

Tips for large-scale rollout

  • Start with a pilot project -- pick a small, well-tested repo to validate each recipe before rolling out broadly.
  • One recipe per PR -- keep each step in its own pull request for clean history and easy reverts.
  • Run tests before and after -- recipes are well-tested, but always verify that your tests still pass.
  • Use CI to enforce new patterns -- see the Encourage usage page for GitHub Actions examples that prevent regression to old patterns.