← All recipes
Moderne licensed

Remove JUnit 4 @RunWith annotations that do not require an @ExtendsWith replacement

Recipe IDorg.openrewrite.java.testing.junit5.RemoveObsoleteRunners
Artifactorg.openrewrite.recipe:rewrite-testing-frameworks

Some JUnit 4 @RunWith annotations do not require replacement with an equivalent JUnit Jupiter @ExtendsWith annotation. This can be used to remove those runners that either do not have a JUnit Jupiter equivalent or do not require a replacement as part of JUnit 4 to 5 migration.

Single recipeMSAL

Usage

You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.java.testing.junit5.RemoveObsoleteRunners --recipe-option "obsoleteRunners=org.junit.runners.JUnit4"

If the recipe isn’t available locally, install it with:

mod config recipes jar install org.openrewrite.recipe:rewrite-testing-frameworks:3.43.0

Options

NameTypeDescription
obsoleteRunnersrequiredListThe fully qualified class names of the JUnit 4 runners to be removed.
e.g. org.junit.runners.JUnit4

Data tables

Structured output this recipe can produce.

  • Source files that had resultsSource files that were modified by the recipe run.org.openrewrite.table.SourcesFileResults
  • Source files that had search resultsSearch results that were found during the recipe run.org.openrewrite.table.SearchResults
  • Source files that errored on a recipeThe details of all errors produced by a recipe run.org.openrewrite.table.SourcesFileErrors
  • Recipe performanceStatistics used in analyzing the performance of recipes.org.openrewrite.table.RecipeRunStats