diff --git a/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestEveryItemToAssertJ.java b/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestEveryItemToAssertJ.java new file mode 100644 index 000000000..34bb08f62 --- /dev/null +++ b/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestEveryItemToAssertJ.java @@ -0,0 +1,128 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://docs.moderne.io/licensing/moderne-source-available-license + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openrewrite.java.testing.hamcrest; + +import lombok.Getter; +import org.jspecify.annotations.Nullable; +import org.openrewrite.ExecutionContext; +import org.openrewrite.Preconditions; +import org.openrewrite.Recipe; +import org.openrewrite.TreeVisitor; +import org.openrewrite.java.JavaIsoVisitor; +import org.openrewrite.java.JavaParser; +import org.openrewrite.java.JavaTemplate; +import org.openrewrite.java.MethodMatcher; +import org.openrewrite.java.search.UsesMethod; +import org.openrewrite.java.tree.Expression; +import org.openrewrite.java.tree.J; + +import java.util.ArrayList; +import java.util.List; + +public class HamcrestEveryItemToAssertJ extends Recipe { + @Getter + final String displayName = "Migrate Hamcrest `everyItem` to AssertJ"; + + @Getter + final String description = "Migrate Hamcrest `everyItem` to AssertJ `allSatisfy` or `hasOnlyElementsOfType`."; + + private static final MethodMatcher ASSERT_THAT_MATCHER = new MethodMatcher("org.hamcrest.MatcherAssert assertThat(..)"); + private static final MethodMatcher EVERY_ITEM_MATCHER = new MethodMatcher("org.hamcrest.*Matchers everyItem(..)"); + private static final MethodMatcher INSTANCE_OF_MATCHER = new MethodMatcher("org.hamcrest.*Matchers instanceOf(..)"); + + @Override + public TreeVisitor getVisitor() { + return Preconditions.check(new UsesMethod<>(EVERY_ITEM_MATCHER), new JavaIsoVisitor() { + @Override + public J.MethodInvocation visitMethodInvocation(J.MethodInvocation methodInvocation, ExecutionContext ctx) { + J.MethodInvocation mi = super.visitMethodInvocation(methodInvocation, ctx); + if (!ASSERT_THAT_MATCHER.matches(mi)) { + return mi; + } + + List args = mi.getArguments(); + Expression reasonArgument = args.size() == 3 ? args.get(0) : null; + Expression actualArgument = args.get(args.size() - 2); + Expression matcherArgument = args.get(args.size() - 1); + if (!EVERY_ITEM_MATCHER.matches(matcherArgument)) { + return mi; + } + + Expression innerMatcher = ((J.MethodInvocation) matcherArgument).getArguments().get(0); + + if (INSTANCE_OF_MATCHER.matches(innerMatcher)) { + return handleInstanceOf(mi, actualArgument, reasonArgument, innerMatcher, ctx); + } + + return handleGeneralMatcher(mi, actualArgument, reasonArgument, innerMatcher, ctx); + } + + private J.MethodInvocation handleInstanceOf(J.MethodInvocation mi, Expression actual, @Nullable Expression reason, + Expression innerMatcher, ExecutionContext ctx) { + Expression typeArg = ((J.MethodInvocation) innerMatcher).getArguments().get(0); + String reasonTemplate = reason != null ? ".as(#{any(String)})" : ""; + JavaTemplate template = JavaTemplate.builder( + "assertThat(#{any()})" + reasonTemplate + ".hasOnlyElementsOfType(#{any(java.lang.Class)})") + .contextSensitive() + .javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "assertj-core-3")) + .staticImports("org.assertj.core.api.Assertions.assertThat") + .build(); + + removeImports(); + maybeRemoveImport("org.hamcrest.Matchers.instanceOf"); + maybeRemoveImport("org.hamcrest.CoreMatchers.instanceOf"); + + List templateArgs = new ArrayList<>(); + templateArgs.add(actual); + if (reason != null) { + templateArgs.add(reason); + } + templateArgs.add(typeArg); + return template.apply(getCursor(), mi.getCoordinates().replace(), templateArgs.toArray()); + } + + private J.MethodInvocation handleGeneralMatcher(J.MethodInvocation mi, Expression actual, @Nullable Expression reason, + Expression innerMatcher, ExecutionContext ctx) { + String reasonTemplate = reason != null ? ".as(#{any(String)})" : ""; + JavaTemplate template = JavaTemplate.builder( + "assertThat(#{any()})" + reasonTemplate + ".allSatisfy(arg -> assertThat(arg, #{any()}))") + .contextSensitive() + .javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, + "assertj-core-3", "hamcrest-3", "junit-jupiter-api-5")) + .staticImports("org.assertj.core.api.Assertions.assertThat") + .build(); + + removeImports(); + + List templateArgs = new ArrayList<>(); + templateArgs.add(actual); + if (reason != null) { + templateArgs.add(reason); + } + templateArgs.add(innerMatcher); + return template.apply(getCursor(), mi.getCoordinates().replace(), templateArgs.toArray()); + } + + private void removeImports() { + maybeRemoveImport("org.hamcrest.Matchers.everyItem"); + maybeRemoveImport("org.hamcrest.CoreMatchers.everyItem"); + maybeRemoveImport("org.hamcrest.MatcherAssert"); + maybeRemoveImport("org.hamcrest.MatcherAssert.assertThat"); + maybeAddImport("org.assertj.core.api.Assertions", "assertThat"); + } + }); + } +} diff --git a/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestHasItemMatcherToAssertJ.java b/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestHasItemMatcherToAssertJ.java new file mode 100644 index 000000000..c058a0bb0 --- /dev/null +++ b/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestHasItemMatcherToAssertJ.java @@ -0,0 +1,127 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://docs.moderne.io/licensing/moderne-source-available-license + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openrewrite.java.testing.hamcrest; + +import lombok.Getter; +import org.jspecify.annotations.Nullable; +import org.openrewrite.ExecutionContext; +import org.openrewrite.Preconditions; +import org.openrewrite.Recipe; +import org.openrewrite.TreeVisitor; +import org.openrewrite.java.JavaIsoVisitor; +import org.openrewrite.java.JavaParser; +import org.openrewrite.java.JavaTemplate; +import org.openrewrite.java.MethodMatcher; +import org.openrewrite.java.search.UsesMethod; +import org.openrewrite.java.tree.Expression; +import org.openrewrite.java.tree.J; + +import java.util.ArrayList; +import java.util.List; + +public class HamcrestHasItemMatcherToAssertJ extends Recipe { + @Getter + final String displayName = "Migrate Hamcrest `hasItem(Matcher)` to AssertJ"; + + @Getter + final String description = "Migrate Hamcrest `hasItem(Matcher)` to AssertJ `hasAtLeastOneElementOfType` or `anySatisfy`."; + + private static final MethodMatcher ASSERT_THAT_MATCHER = new MethodMatcher("org.hamcrest.MatcherAssert assertThat(..)"); + private static final MethodMatcher HAS_ITEM_WITH_MATCHER = new MethodMatcher("org.hamcrest.*Matchers hasItem(org.hamcrest.Matcher)"); + private static final MethodMatcher INSTANCE_OF_MATCHER = new MethodMatcher("org.hamcrest.*Matchers instanceOf(..)"); + + @Override + public TreeVisitor getVisitor() { + return Preconditions.check(new UsesMethod<>(HAS_ITEM_WITH_MATCHER), new JavaIsoVisitor() { + @Override + public J.MethodInvocation visitMethodInvocation(J.MethodInvocation methodInvocation, ExecutionContext ctx) { + J.MethodInvocation mi = super.visitMethodInvocation(methodInvocation, ctx); + if (!ASSERT_THAT_MATCHER.matches(mi)) { + return mi; + } + + List args = mi.getArguments(); + Expression reasonArgument = args.size() == 3 ? args.get(0) : null; + Expression actualArgument = args.get(args.size() - 2); + Expression matcherArgument = args.get(args.size() - 1); + if (!HAS_ITEM_WITH_MATCHER.matches(matcherArgument)) { + return mi; + } + + Expression innerMatcher = ((J.MethodInvocation) matcherArgument).getArguments().get(0); + if (INSTANCE_OF_MATCHER.matches(innerMatcher)) { + return handleInstanceOf(mi, actualArgument, reasonArgument, innerMatcher, ctx); + } + + return handleGeneralMatcher(mi, actualArgument, reasonArgument, innerMatcher, ctx); + } + + private J.MethodInvocation handleInstanceOf(J.MethodInvocation mi, Expression actual, @Nullable Expression reason, + Expression innerMatcher, ExecutionContext ctx) { + Expression typeArg = ((J.MethodInvocation) innerMatcher).getArguments().get(0); + String reasonTemplate = reason != null ? ".as(#{any(String)})" : ""; + JavaTemplate template = JavaTemplate.builder( + "assertThat(#{any()})" + reasonTemplate + ".hasAtLeastOneElementOfType(#{any(java.lang.Class)})") + .contextSensitive() + .javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "assertj-core-3")) + .staticImports("org.assertj.core.api.Assertions.assertThat") + .build(); + + removeImports(); + maybeRemoveImport("org.hamcrest.Matchers.instanceOf"); + maybeRemoveImport("org.hamcrest.CoreMatchers.instanceOf"); + + List templateArgs = new ArrayList<>(); + templateArgs.add(actual); + if (reason != null) { + templateArgs.add(reason); + } + templateArgs.add(typeArg); + return template.apply(getCursor(), mi.getCoordinates().replace(), templateArgs.toArray()); + } + + private J.MethodInvocation handleGeneralMatcher(J.MethodInvocation mi, Expression actual, @Nullable Expression reason, + Expression innerMatcher, ExecutionContext ctx) { + String reasonTemplate = reason != null ? ".as(#{any(String)})" : ""; + JavaTemplate template = JavaTemplate.builder( + "assertThat(#{any()})" + reasonTemplate + ".anySatisfy(arg -> assertThat(arg, #{any()}))") + .contextSensitive() + .javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, + "assertj-core-3", "hamcrest-3", "junit-jupiter-api-5")) + .staticImports("org.assertj.core.api.Assertions.assertThat") + .build(); + + removeImports(); + + List templateArgs = new ArrayList<>(); + templateArgs.add(actual); + if (reason != null) { + templateArgs.add(reason); + } + templateArgs.add(innerMatcher); + return template.apply(getCursor(), mi.getCoordinates().replace(), templateArgs.toArray()); + } + + private void removeImports() { + maybeRemoveImport("org.hamcrest.Matchers.hasItem"); + maybeRemoveImport("org.hamcrest.CoreMatchers.hasItem"); + maybeRemoveImport("org.hamcrest.MatcherAssert"); + maybeRemoveImport("org.hamcrest.MatcherAssert.assertThat"); + maybeAddImport("org.assertj.core.api.Assertions", "assertThat"); + } + }); + } +} diff --git a/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestHasPropertyToAssertJ.java b/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestHasPropertyToAssertJ.java new file mode 100644 index 000000000..6f327584a --- /dev/null +++ b/src/main/java/org/openrewrite/java/testing/hamcrest/HamcrestHasPropertyToAssertJ.java @@ -0,0 +1,143 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://docs.moderne.io/licensing/moderne-source-available-license + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openrewrite.java.testing.hamcrest; + +import lombok.Getter; +import org.jspecify.annotations.Nullable; +import org.openrewrite.ExecutionContext; +import org.openrewrite.Preconditions; +import org.openrewrite.Recipe; +import org.openrewrite.TreeVisitor; +import org.openrewrite.java.JavaIsoVisitor; +import org.openrewrite.java.JavaParser; +import org.openrewrite.java.JavaTemplate; +import org.openrewrite.java.MethodMatcher; +import org.openrewrite.java.search.UsesMethod; +import org.openrewrite.java.tree.Expression; +import org.openrewrite.java.tree.J; + +import java.util.ArrayList; +import java.util.List; + +public class HamcrestHasPropertyToAssertJ extends Recipe { + @Getter + final String displayName = "Migrate Hamcrest `hasProperty` to AssertJ"; + + @Getter + final String description = "Migrate Hamcrest `hasProperty` to AssertJ `hasFieldOrProperty` and `hasFieldOrPropertyWithValue`."; + + private static final MethodMatcher ASSERT_THAT_MATCHER = new MethodMatcher("org.hamcrest.MatcherAssert assertThat(..)"); + private static final MethodMatcher HAS_PROPERTY_MATCHER = new MethodMatcher("org.hamcrest.*Matchers hasProperty(..)"); + private static final MethodMatcher EQUAL_TO_MATCHER = new MethodMatcher("org.hamcrest.*Matchers equalTo(..)"); + private static final MethodMatcher IS_MATCHER = new MethodMatcher("org.hamcrest.*Matchers is(..)"); + private static final MethodMatcher IS_NESTED_MATCHER = new MethodMatcher("org.hamcrest.*Matchers is(org.hamcrest.Matcher)"); + + @Override + public TreeVisitor getVisitor() { + return Preconditions.check(new UsesMethod<>(HAS_PROPERTY_MATCHER), new JavaIsoVisitor() { + @Override + public J.MethodInvocation visitMethodInvocation(J.MethodInvocation methodInvocation, ExecutionContext ctx) { + J.MethodInvocation mi = super.visitMethodInvocation(methodInvocation, ctx); + if (!ASSERT_THAT_MATCHER.matches(mi)) { + return mi; + } + + List args = mi.getArguments(); + Expression reasonArgument = args.size() == 3 ? args.get(0) : null; + Expression actualArgument = args.get(args.size() - 2); + Expression matcherArgument = args.get(args.size() - 1); + + if (!HAS_PROPERTY_MATCHER.matches(matcherArgument)) { + return mi; + } + + List hasPropertyArgs = ((J.MethodInvocation) matcherArgument).getArguments(); + if (hasPropertyArgs.size() == 1) { + return handleSingleArg(mi, actualArgument, reasonArgument, hasPropertyArgs.get(0), ctx); + } + if (hasPropertyArgs.size() == 2) { + return handleTwoArgs(mi, actualArgument, reasonArgument, hasPropertyArgs.get(0), hasPropertyArgs.get(1), ctx); + } + return mi; + } + + private J.MethodInvocation handleSingleArg(J.MethodInvocation mi, Expression actual, @Nullable Expression reason, + Expression propertyName, ExecutionContext ctx) { + String reasonTemplate = reason != null ? ".as(#{any(String)})" : ""; + JavaTemplate template = JavaTemplate.builder( + "assertThat(#{any()})" + reasonTemplate + ".hasFieldOrProperty(#{any(String)})") + .contextSensitive() + .javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "assertj-core-3")) + .staticImports("org.assertj.core.api.Assertions.assertThat") + .build(); + + removeImports(); + List templateArgs = new ArrayList<>(); + templateArgs.add(actual); + if (reason != null) { + templateArgs.add(reason); + } + templateArgs.add(propertyName); + return template.apply(getCursor(), mi.getCoordinates().replace(), templateArgs.toArray()); + } + + private J.MethodInvocation handleTwoArgs(J.MethodInvocation mi, Expression actual, @Nullable Expression reason, + Expression propertyName, Expression valueMatcher, ExecutionContext ctx) { + // Unwrap equalTo(val) or is(val) where is is not is(Matcher) + Expression value; + if (EQUAL_TO_MATCHER.matches(valueMatcher)) { + value = ((J.MethodInvocation) valueMatcher).getArguments().get(0); + } else if (IS_MATCHER.matches(valueMatcher) && !IS_NESTED_MATCHER.matches(valueMatcher)) { + value = ((J.MethodInvocation) valueMatcher).getArguments().get(0); + } else { + // Unknown matcher, don't convert + return mi; + } + + String reasonTemplate = reason != null ? ".as(#{any(String)})" : ""; + JavaTemplate template = JavaTemplate.builder( + "assertThat(#{any()})" + reasonTemplate + ".hasFieldOrPropertyWithValue(#{any(String)}, #{any()})") + .contextSensitive() + .javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "assertj-core-3")) + .staticImports("org.assertj.core.api.Assertions.assertThat") + .build(); + + removeImports(); + maybeRemoveImport("org.hamcrest.Matchers.equalTo"); + maybeRemoveImport("org.hamcrest.CoreMatchers.equalTo"); + maybeRemoveImport("org.hamcrest.Matchers.is"); + maybeRemoveImport("org.hamcrest.CoreMatchers.is"); + + List templateArgs = new ArrayList<>(); + templateArgs.add(actual); + if (reason != null) { + templateArgs.add(reason); + } + templateArgs.add(propertyName); + templateArgs.add(value); + return template.apply(getCursor(), mi.getCoordinates().replace(), templateArgs.toArray()); + } + + private void removeImports() { + maybeRemoveImport("org.hamcrest.Matchers.hasProperty"); + maybeRemoveImport("org.hamcrest.CoreMatchers.hasProperty"); + maybeRemoveImport("org.hamcrest.MatcherAssert"); + maybeRemoveImport("org.hamcrest.MatcherAssert.assertThat"); + maybeAddImport("org.assertj.core.api.Assertions", "assertThat"); + } + }); + } +} diff --git a/src/main/resources/META-INF/rewrite/hamcrest.yml b/src/main/resources/META-INF/rewrite/hamcrest.yml index 2f40c3b59..7130285f9 100644 --- a/src/main/resources/META-INF/rewrite/hamcrest.yml +++ b/src/main/resources/META-INF/rewrite/hamcrest.yml @@ -107,6 +107,15 @@ recipeList: # Convert `assertThat(x, allOf(..))` to `assertThat(x).satisfies(..)` and `anyOf` to `satisfiesAnyOf` - org.openrewrite.java.testing.hamcrest.HamcrestOfMatchersToAssertJ + # Convert `assertThat(x, hasProperty(..))` to `assertThat(x).hasFieldOrProperty(..)` / `hasFieldOrPropertyWithValue(..)` + - org.openrewrite.java.testing.hamcrest.HamcrestHasPropertyToAssertJ + + # Convert `assertThat(x, everyItem(..))` to `assertThat(x).hasOnlyElementsOfType(..)` / `allSatisfy(..)` + - org.openrewrite.java.testing.hamcrest.HamcrestEveryItemToAssertJ + + # Convert `assertThat(x, hasItem(Matcher))` to `assertThat(x).hasAtLeastOneElementOfType(..)` / `anySatisfy(..)` + - org.openrewrite.java.testing.hamcrest.HamcrestHasItemMatcherToAssertJ + # Convert `assertThat(x, is(value))` to `assertThat(x).isEqualTo(value)` - org.openrewrite.java.testing.hamcrest.HamcrestIsMatcherToAssertJ diff --git a/src/main/resources/META-INF/rewrite/recipes.csv b/src/main/resources/META-INF/rewrite/recipes.csv index e66ad055c..9030c60d3 100644 --- a/src/main/resources/META-INF/rewrite/recipes.csv +++ b/src/main/resources/META-INF/rewrite/recipes.csv @@ -1,228 +1,231 @@ -ecosystem,packageName,name,displayName,description,recipeCount,category1,category2,category3,category1Description,category2Description,category3Description,options -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.arquillian.ReplaceArquillianInSequenceAnnotation,Arquillian JUnit 4 `@InSequence` to JUnit Jupiter `@Order`,Transforms the Arquillian JUnit 4 `@InSequence` to the JUnit Jupiter `@Order`.,1,Arquillian,Testing,Java,Recipes for [Arquillian](https://arquillian.org/) integration testing framework.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.arquillian.ArquillianJUnit4ToArquillianJUnit5,Use Arquillian JUnit 5 Extension,Migrates Arquillian JUnit 4 to JUnit 5.,9,Arquillian,Testing,Java,Recipes for [Arquillian](https://arquillian.org/) integration testing framework.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions,Adopt AssertJ Duration assertions,Adopt AssertJ `DurationAssert` assertions for more expressive messages.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes,Adopt AssertJ BigInteger Assertions,Adopt AssertJ BigInteger Assertions. Favor semantically explicit methods (e.g. `myBigInteger.isZero()` over `myBigInteger.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes,Adopt AssertJ Byte Assertions,Adopt AssertJ Byte Assertions. Favor semantically explicit methods (e.g. `myByte.isZero()` over `myByte.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes,Adopt AssertJ Double Assertions,Adopt AssertJ Double Assertions. Favor semantically explicit methods (e.g. `myDouble.isZero()` over `myDouble.isEqualTo(0.0)`).,13,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsCloseToWithOffsetRecipe,Replace `isEqualTo` with `isCloseTo`,Replace `isEqualTo` with `isCloseTo` when `offset` or `percentage` is provided.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes,Adopt AssertJ Float Assertions,Adopt AssertJ Float Assertions. Favor semantically explicit methods (e.g. `myFloat.isZero()` over `myFloat.isEqualTo(0.0f)`).,13,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsCloseToWithOffsetRecipe,Replace `isEqualTo` with `isCloseTo`,Replace `isEqualTo` with `isCloseTo` when `offset` or `percentage` is provided.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes,Adopt AssertJ Integer Assertions,Adopt AssertJ Integer Assertions. Favor semantically explicit methods (e.g. `myInteger.isZero()` over `myInteger.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes,Adopt AssertJ Long Assertions,Adopt AssertJ Long Assertions. Favor semantically explicit methods (e.g. `myLong.isZero()` over `myLong.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes,Adopt AssertJ Short Assertions,Adopt AssertJ Short Assertions. Favor semantically explicit methods (e.g. `myShort.isZero()` over `myShort.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.CollapseConsecutiveAssertThatStatements,Collapse consecutive `assertThat` statements,Collapse consecutive `assertThat` statements into single `assertThat` chained statement. This recipe ignores `assertThat` statements that have method invocation as parameter.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.IsEqualToIgnoringMillisToIsCloseToRecipe,"Replace `AbstractDateAssert#isEqualToIgnoringMillis(java.util.Date)` by `by isCloseTo(Date, long)`",`isEqualToIgnoringMillis()` is deprecated in favor of `isCloseTo()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertArrayEqualsToAssertThat,JUnit `assertArrayEquals` to assertJ,Convert JUnit-style `assertArrayEquals()` to AssertJ's `assertThat().contains()` equivalents.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertEqualsToAssertThat,JUnit `assertEquals` to AssertJ,Convert JUnit-style `assertEquals()` to AssertJ's `assertThat().isEqualTo()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertFalseToAssertThat,JUnit `assertFalse` to AssertJ,Convert JUnit-style `assertFalse()` to AssertJ's `assertThat().isFalse()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertInstanceOfToAssertThat,JUnit `assertInstanceOf` to AssertJ,Convert JUnit-style `assertInstanceOf()` to AssertJ's `assertThat().isInstanceOf()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertNotEqualsToAssertThat,JUnit `assertNotEquals` to AssertJ,Convert JUnit-style `assertNotEquals()` to AssertJ's `assertThat().isNotEqualTo()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertNotNullToAssertThat,JUnit `assertNotNull` to AssertJ,Convert JUnit-style `assertNotNull()` to AssertJ's `assertThat().isNotNull()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertNullToAssertThat,JUnit `assertNull` to AssertJ,Convert JUnit-style `assertNull()` to AssertJ's `assertThat().isNull()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertSameToAssertThat,JUnit `assertSame` to AssertJ,Convert JUnit-style `assertSame()` to AssertJ's `assertThat().isSameAs()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertThrowsToAssertExceptionType,JUnit AssertThrows to AssertJ exceptionType,Convert `JUnit#AssertThrows` to `AssertJ#assertThatExceptionOfType` to allow for chained assertions on the thrown exception.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertTrueToAssertThat,JUnit `assertTrue` to AssertJ,Convert JUnit-style `assertTrue()` to AssertJ's `assertThat().isTrue()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitFailToAssertJFail,JUnit fail to AssertJ,Convert JUnit-style `fail()` to AssertJ's `fail()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitTryFailToAssertThatThrownBy,Convert try-catch-fail blocks to AssertJ's assertThatThrownBy,"Replace try-catch blocks where the try block ends with a `fail()` statement and the catch block optionally contains assertions, with AssertJ's `assertThatThrownBy()`.",1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.ReturnActual,Collapse `assertThat` followed by `return` into single statement,Collapse an `assertThat` statement followed by a `return` of the same object into a single `return assertThat(...).assertions().actual()` statement.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyAssertJAssertion,Simplify AssertJ assertions with literal arguments,Simplify AssertJ assertions by replacing them with more expressive dedicated assertions.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""assertToReplace"",""type"":""String"",""displayName"":""AssertJ assertion"",""description"":""The assertion method that should be replaced."",""example"":""hasSize""},{""name"":""literalArgument"",""type"":""String"",""displayName"":""Assertion argument literal"",""description"":""The literal argument passed into the assertion to replace; use \""null\"" for `null`."",""example"":""0"",""required"":true},{""name"":""dedicatedAssertion"",""type"":""String"",""displayName"":""Dedicated assertion"",""description"":""The zero argument assertion to adopt instead."",""example"":""isEmpty"",""required"":true},{""name"":""requiredType"",""type"":""String"",""displayName"":""Required type"",""description"":""The type of the actual assertion argument."",""example"":""java.lang.String"",""required"":true}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion,Simplify AssertJ chained assertions,Many AssertJ chained assertions have dedicated assertions that function the same. It is best to use the dedicated assertions.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""chainedAssertion"",""type"":""String"",""displayName"":""AssertJ chained assertion"",""description"":""The chained AssertJ assertion to move to dedicated assertion."",""example"":""equals""},{""name"":""assertToReplace"",""type"":""String"",""displayName"":""AssertJ replaced assertion"",""description"":""The AssertJ assert that should be replaced."",""example"":""isTrue""},{""name"":""dedicatedAssertion"",""type"":""String"",""displayName"":""AssertJ replacement assertion"",""description"":""The AssertJ method to migrate to."",""example"":""isEqualTo""},{""name"":""requiredType"",""type"":""String"",""displayName"":""Required type"",""description"":""The type of the actual assertion argument."",""example"":""java.lang.String""}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyHasSizeAssertion,Simplify AssertJ assertions with `hasSize` argument,Simplify AssertJ assertions by replacing `hasSize` with `hasSameSizeAs` dedicated assertions.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyRedundantAssertJChains,Simplify redundant AssertJ assertion chains,Removes redundant AssertJ assertions when chained methods already provide the same or stronger guarantees.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifySequencedCollectionAssertions,Simplify AssertJ assertions on SequencedCollection,"Simplify AssertJ assertions on SequencedCollection by using dedicated assertion methods. For example, `assertThat(sequencedCollection.getLast())` can be simplified to `assertThat(sequencedCollection).last()`.",1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyStreamMapToExtracting,Simplify `assertThat(collection.stream().map(...))` to `assertThat(collection).extracting(...)`,Simplifies AssertJ assertions that use `stream().map()` to extract values from a collection by using the dedicated `extracting()` method instead. This makes the assertion more readable and leverages AssertJ's built-in extraction capabilities.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.Assertj,AssertJ best practices,Migrates JUnit asserts to AssertJ and applies best practices to assertions.,1701,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.StaticImports,Statically import AssertJ's `assertThat`,Consistently use a static import rather than inlining the `Assertions` class name in tests.,5,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertions,Simplify AssertJ chained assertions,Replace AssertJ assertions where a method is called on the actual value with a dedicated assertion.,125,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyAssertJAssertions,Shorten AssertJ assertions,Replace AssertJ assertions where a dedicated assertion is available for the same actual value.,17,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitToAssertj,Migrate JUnit asserts to AssertJ,"AssertJ provides a rich set of assertions, truly helpful error messages, improves test code readability. Converts assertions from `org.junit.jupiter.api.Assertions` to `org.assertj.core.api.Assertions`. Will convert JUnit 4 to JUnit Jupiter if necessary to match and modify assertions.",629,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.FestToAssertj,Migrate Fest 2.x to AssertJ,"AssertJ provides a rich set of assertions, truly helpful error messages, improves test code readability. Converts Fest 2.x imports to AssertJ imports.",19,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsBooleanToAssertBoolean,"Replace JUnit `assertEquals(false, )` to `assertFalse()` / `assertTrue()`",Using `assertFalse` or `assertTrue` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsNullToAssertNull,"`assertEquals(a, null)` to `assertNull(a)`",Using `assertNull(a)` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseEqualsToAssertNotEquals,"Replace JUnit `assertFalse(a.equals(b))` to `assertNotEquals(a,b)`","Using `assertNotEquals(a,b)` is simpler and more clear.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseNegationToAssertTrue,Replace JUnit `assertFalse(!)` to `assertTrue()`,Using `assertTrue` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseNullToAssertNotNull,Replace JUnit `assertFalse(a == null)` to `assertNotNull(a)`,Using `assertNotNull(a)` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanRemovedRecipe,Remove JUnit `assertTrue(true)` and `assertFalse(false)`,These assertions are redundant and do not provide any value. They can be safely removed.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipes,Replace JUnit `assertTrue(false)` and `assertFalse(true)` with `fail()`,Using fail is more direct and clear.,5,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipes$WithMessageRecipe,"Replace JUnit `assertTrue(false, ""reason"")` and `assertFalse(true, ""reason"")` with `fail(""reason"")`",Using fail is more direct and clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipes$WithoutMessageRecipe,Replace JUnit `assertTrue(false)` and `assertFalse(true)` with `fail()`,Using fail is more direct and clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertNotEqualsBooleanToAssertBoolean,"Replace JUnit `assertNotEquals(false, )` to `assertFalse()` / `assertTrue()`",Using `assertFalse` or `assertTrue` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueComparisonToAssertEquals,"Junit `assertTrue(a == b)` to `assertEquals(a,b)`","Using `assertEquals(a,b)` is simpler and more clear.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueEqualsToAssertEquals,"Replace JUnit `assertTrue(a.equals(b))` to `assertEquals(a,b)`","Using `assertEquals(a,b)` is simpler and more clear.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueNegationToAssertFalse,Replace JUnit `assertTrue(!)` to `assertFalse()`,Using `assertFalse` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueNullToAssertNull,Replace JUnit `assertTrue(a == null)` to `assertNull(a)`,Using `assertNull(a)` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertionsArgumentOrder,Assertion arguments should be passed in the correct order,"Assertions such as `org.junit.Assert.assertEquals` expect the first argument to be the expected value and the second argument to be the actual value; for `org.testng.Assert`, it’s the other way around. This recipe detects `J.Literal`, `J.NewArray`, and `java.util.Iterable` arguments swapping them if necessary so that the error messages won't be confusing.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.KotlinTestMethodsShouldReturnUnit,Kotlin test methods should have return type `Unit`,"Kotlin test methods annotated with `@Test`, `@ParameterizedTest`, `@RepeatedTest`, `@TestTemplate` should have `Unit` return type. Other return types can cause test discovery issues, and warnings as of JUnit 5.13+. This recipe changes the return type to `Unit` and removes `return` statements.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.RemoveEmptyTests,Remove empty tests without comments,Removes empty methods with a `@Test` annotation if the body does not have comments.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.RemoveTestPrefix,Remove `test` prefix from JUnit 5 tests,"Remove `test` from methods with `@Test`, `@ParameterizedTest`, `@RepeatedTest` or `@TestFactory`. They no longer have to prefix test to be usable by JUnit 5.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.SimplifyTestThrows,Simplify `throws` statements of tests,Replace all thrown exception classes of test method signatures by `Exception`.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.TestMethodsShouldBeVoid,Test methods should have void return type,"Test methods annotated with `@Test`, `@ParameterizedTest`, `@RepeatedTest`, `@TestTemplate` should have `void` return type. Non-void return types can cause test discovery issues, and warnings as of JUnit 5.13+. This recipe changes the return type to `void` and removes `return` statements.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.TestsShouldIncludeAssertions,Include an assertion in tests,"For tests not having any assertions, wrap the statements with JUnit Jupiter's `Assertions#assertDoesNotThrow(..)`.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""additionalAsserts"",""type"":""String"",""displayName"":""Additional assertions"",""description"":""A comma delimited list of packages and/or classes that will be identified as assertions. I.E. a common assertion utility `org.foo.TestUtil`."",""example"":""org.foo.TestUtil, org.bar""}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.TestsShouldNotBePublic,Remove `public` visibility of JUnit 5 tests,"Remove `public` and optionally `protected` modifiers from methods with `@Test`, `@ParameterizedTest`, `@RepeatedTest`, `@TestFactory`, `@BeforeEach`, `@AfterEach`, `@BeforeAll`, or `@AfterAll`. They no longer have to be public visibility to be usable by JUnit 5.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""removeProtectedModifiers"",""type"":""Boolean"",""displayName"":""Remove protected modifiers"",""description"":""Also remove protected modifiers from test methods"",""example"":""true""}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.BestPractices,Testing best practices,Applies best practices to tests.,5,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.dbrider.ExecutionListenerToDbRiderAnnotation,Migrate the `DBRiderTestExecutionListener` to the `@DBRider` annotation,Migrate the `DBRiderTestExecutionListener` to the `@DBRider` annotation. This recipe is useful when migrating from JUnit 4 `dbrider-spring` to JUnit 5 `dbrider-junit5`.,1,DBRider,Testing,Java,Recipes for [DBRider](https://database-rider.github.io/database-rider/) database testing framework.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.dbrider.MigrateDbRiderSpringToDbRiderJUnit5,Migrate rider-spring (JUnit4) to rider-junit5 (JUnit5),This recipe will migrate the necessary dependencies and annotations from DbRider with JUnit4 to JUnit5 in a Spring application.,5,DBRider,Testing,Java,Recipes for [DBRider](https://database-rider.github.io/database-rider/) database testing framework.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.easymock.EasyMockVerifyToMockitoVerify,Replace EasyMock `verify` calls with Mockito `verify` calls,Replace `EasyMock.verify(dependency)` with individual `Mockito.verify(dependency).method()` calls based on expected methods.,1,EasyMock,Testing,Java,Recipes for migrating from [EasyMock](https://easymock.org/) to Mockito.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.easymock.RemoveExtendsEasyMockSupport,Migrate Test classes that extend `org.easymock.EasyMockSupport` to use Mockito,Modify test classes by removing extends EasyMockSupport and replacing EasyMock methods with Mockito equivalents.,1,EasyMock,Testing,Java,Recipes for migrating from [EasyMock](https://easymock.org/) to Mockito.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.easymock.EasyMockToMockito,Migrate from EasyMock to Mockito,This recipe will apply changes commonly needed when migrating from EasyMock to Mockito.,317,EasyMock,Testing,Java,Recipes for migrating from [EasyMock](https://easymock.org/) to Mockito.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.AssertThatBooleanToAssertJ,"Migrate Hamcrest `assertThat(boolean, Matcher)` to AssertJ","Replace Hamcrest `assertThat(String, boolean)` with AssertJ `assertThat(boolean).as(String).isTrue()`.",1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestInstanceOfToJUnit5,Migrate from Hamcrest `instanceOf` matcher to JUnit 5,Migrate from Hamcrest `instanceOf` and `isA` matcher to JUnit5 `assertInstanceOf` assertion.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestIsMatcherToAssertJ,Migrate Hamcrest `is(Object)` to AssertJ,Migrate Hamcrest `is(Object)` to AssertJ `Assertions.assertThat(..)`.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestMatcherToAssertJ,Migrate from Hamcrest `Matcher` to AssertJ,Migrate from Hamcrest `Matcher` to AssertJ assertions.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,"[{""name"":""matcher"",""type"":""String"",""displayName"":""Hamcrest matcher"",""description"":""The Hamcrest `Matcher` to migrate to JUnit5."",""example"":""equalTo""},{""name"":""assertion"",""type"":""String"",""displayName"":""AssertJ assertion"",""description"":""The AssertJ method to migrate to."",""example"":""isEqualTo""},{""name"":""argumentType"",""type"":""String"",""displayName"":""Argument type"",""description"":""The type of the argument to the Hamcrest `Matcher`."",""example"":""java.math.BigDecimal""}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestMatcherToJUnit5,Migrate from Hamcrest `Matcher` to JUnit 5,Migrate from Hamcrest `Matcher` to JUnit 5 assertions.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestNotMatcherToAssertJ,Migrate Hamcrest `not(Matcher)` to AssertJ,Migrate from Hamcrest `not(Matcher)` to AssertJ assertions.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,"[{""name"":""notMatcher"",""type"":""String"",""displayName"":""Hamcrest Matcher"",""description"":""The Hamcrest `not(Matcher)` to migrate to JUnit5."",""example"":""equalTo""},{""name"":""assertion"",""type"":""String"",""displayName"":""AssertJ Assertion"",""description"":""The AssertJ method to migrate to."",""example"":""isNotEqualTo""}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestOfMatchersToAssertJ,Migrate `anyOf` Hamcrest Matcher to AssertJ,Migrate the `anyOf` Hamcrest Matcher to AssertJ's `satisfiesAnyOf` assertion.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.RemoveIsMatcher,Remove Hamcrest `is(Matcher)`,Remove Hamcrest `is(Matcher)` ahead of migration.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.AddHamcrestIfUsed,Add `org.hamcrest:hamcrest` if it is used,"JUnit Jupiter does not include hamcrest as a transitive dependency. If needed, add a direct dependency.",3,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.ConsistentHamcrestMatcherImports,Use consistent Hamcrest matcher imports,"Use consistent imports for Hamcrest matchers, and remove wrapping `is(Matcher)` calls ahead of further changes.",7,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.MigrateHamcrestToJUnit5,Migrate Hamcrest assertions to JUnit Jupiter,Migrate Hamcrest `assertThat(..)` to JUnit Jupiter `Assertions`.,19,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ,Migrate Hamcrest assertions to AssertJ,Migrate Hamcrest `assertThat(..)` to AssertJ `Assertions`.,171,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitAnnotatedArgumentToMockito,Convert JMockit `@Mocked` and `@Injectable` annotated arguments,Convert JMockit `@Mocked` and `@Injectable` annotated arguments into Mockito statements.,1,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitBlockToMockito,"Rewrite JMockit Expectations, NonStrictExpectations, Verifications, VerificationsInOrder, FullVerifications","Rewrites JMockit `Expectations, NonStrictExpectations, Verifications, VerificationsInOrder, FullVerifications` blocks to Mockito statements.",1,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitMockUpToMockito,Rewrite JMockit MockUp to Mockito statements,Rewrites JMockit `MockUp` blocks to Mockito statements. This recipe will not rewrite private methods in MockUp.,1,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitToMockito,Migrate from JMockit to Mockito,This recipe will apply changes commonly needed when migrating from JMockit to Mockito.,249,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddMissingNested,JUnit 5 inner test classes should be annotated with `@Nested`,Adds `@Nested` to inner classes that contain JUnit 5 tests.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddMissingTestBeforeAfterAnnotations,"Add missing `@BeforeEach`, `@AfterEach`, `@Test` to overriding methods","Adds `@BeforeEach`, `@AfterEach`, `@Test` to methods overriding superclass methods if the annotations are present on the superclass method.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddParameterizedTestAnnotation,Add missing `@ParameterizedTest` annotation when `@ValueSource` is used or replace `@Test` with `@ParameterizedTest`,Add missing `@ParameterizedTest` annotation when `@ValueSource` is used or replace `@Test` with `@ParameterizedTest`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssertThrowsOnLastStatement,Applies JUnit 5 `assertThrows` on last statement in lambda block only,"Applies JUnit 5 `assertThrows` on last statement in lambda block only. In rare cases may cause compilation errors if the lambda uses effectively non final variables. In some cases, tests might fail if earlier statements in the lambda block throw exceptions.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssertToAssertions,JUnit 4 `Assert` To JUnit Jupiter `Assertions`,Change JUnit 4's `org.junit.Assert` into JUnit Jupiter's `org.junit.jupiter.api.Assertions`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssertTrueInstanceofToAssertInstanceOf,"`assertTrue(x instanceof y)` to `assertInstanceOf(y.class, x)`","Migration of JUnit4 (or potentially JUnit5) test case in form of assertTrue(x instanceof y) to assertInstanceOf(y.class, x).",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssumeNotNullToAssumptionsRecipes,Transform `Assume` methods to `Assumptions`,Transform `Assume` methods without a direct counterpart to equivalent assumptions in `Assumptions`.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssumeNotNullToAssumptionsRecipes$SingleArgRecipe,Transform singlar `assumeNotNull(object)` to `assumeFalse(object == null)`,Transform singlar `Assume.assumeNotNull(object)` to `Assumptions.assumeFalse(object == null)`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssumeNotNullToAssumptionsRecipes$VarArgsRecipe,Transform variadic `assumeNotNull(objects...)` to a stream of `assumeFalse(object == null)`,"Transform `Assume.assumeNotNull(objects...)` to `Stream.of(object1, object2).forEach(o -> Assumptions.assumeFalse(o == null))`.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CategoryToTag,JUnit 4 `@Category` to JUnit Jupiter `@Tag`,"Transforms the JUnit 4 `@Category`, which can list multiple categories, into one `@Tag` annotation per category listed.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CleanupJUnitImports,Cleanup JUnit imports,Removes unused `org.junit` import symbols.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CleanupKotlinJUnit5AssertionImports,Remove JUnit 5 static Assertions imports in Kotlin when wildcard import is present,"In Kotlin, when both `import org.junit.jupiter.api.*` and static imports from `org.junit.jupiter.api.Assertions` are present, there is overload resolution ambiguity between the Java static methods and the Kotlin extension functions. This recipe removes the static Assertions imports when the wildcard import is present, allowing the Kotlin extension functions to be used instead.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CsvSourceToValueSource,Replace `@CsvSource` with `@ValueSource` for single method arguments,Replaces JUnit 5's `@CsvSource` annotation with `@ValueSource` when the parameterized test has only a single method argument.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.EnclosedToNested,JUnit 4 `@RunWith(Enclosed.class)` to JUnit Jupiter `@Nested`,"Removes the `Enclosed` specification from a class, with `Nested` added to its inner classes by `AddMissingNested`.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.EnvironmentVariables,Migrate JUnit 4 environmentVariables rule to JUnit 5 system stubs extension,Replaces usage of the JUnit 4 `@Rule EnvironmentVariables` with the JUnit 5-compatible `SystemStubsExtension` and `@SystemStub EnvironmentVariables` from the System Stubs library.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ExpectedExceptionToAssertThrows,JUnit 4 `ExpectedException` To JUnit Jupiter's `assertThrows()`,Replace usages of JUnit 4's `@Rule ExpectedException` with JUnit 5's `Assertions.assertThrows()`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.GradleUseJunitJupiter,Gradle `Test` use JUnit Jupiter,By default Gradle's `Test` tasks use JUnit 4. Gradle `Test` tasks must be configured with `useJUnitPlatform()` to run JUnit Jupiter tests. This recipe adds the `useJUnitPlatform()` method call to the `Test` task configuration.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.HandleExternalResourceRules,Handle the usage of ExternalResourceRule fields using @ExtendWith(ExternalResourceSupport.class),Handles the usage of the ExternalResourceRule fields by adding the @ExtendWith(ExternalResourceSupport.class) annotation to the test class.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.JUnitParamsRunnerToParameterized,Pragmatists `@RunWith(JUnitParamsRunner.class)` to JUnit Jupiter `@Parameterized` tests,Convert Pragmatists Parameterized test to the JUnit Jupiter ParameterizedTest equivalent.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.LifecycleNonPrivate,Make lifecycle methods non private,"Make JUnit 5's `@AfterAll`, `@AfterEach`, `@BeforeAll` and `@BeforeEach` non private.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MigrateAssertionFailedError,Migrate JUnit 4 assertion failure exceptions to JUnit Jupiter,Replace JUnit 4's `junit.framework.AssertionFailedError` and `org.junit.ComparisonFailure` with JUnit Jupiter's `org.opentest4j.AssertionFailedError`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MigrateJUnitTestCase,Migrate JUnit 4 `TestCase` to JUnit Jupiter,Convert JUnit 4 `TestCase` to JUnit Jupiter.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MockitoJUnitToMockitoExtension,JUnit 4 `MockitoJUnit` to JUnit Jupiter `MockitoExtension`,Replaces `MockitoJUnit` rules with `MockitoExtension`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ParameterizedRunnerToParameterized,JUnit 4 `@RunWith(Parameterized.class)` to JUnit Jupiter parameterized tests,Convert JUnit 4 parameterized runner the JUnit Jupiter parameterized test equivalent.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RemoveDuplicateTestTemplates,Remove duplicates uses of @TestTemplate implementations for a single method,Remove duplicates uses of @TestTemplate implementations for a single method.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RemoveObsoleteRunners,Remove JUnit 4 `@RunWith` annotations that do not require an `@ExtendsWith` replacement,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.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,"[{""name"":""obsoleteRunners"",""type"":""List"",""displayName"":""Obsolete Runners"",""description"":""The fully qualified class names of the JUnit 4 runners to be removed."",""example"":""org.junit.runners.JUnit4"",""required"":true}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RemoveTryCatchFailBlocks,Replace `fail()` in `try-catch` blocks with `Assertions.assertDoesNotThrow(() -> { ... })`,Replace `try-catch` blocks where `catch` merely contains a `fail()` for `fail(String)` statement with `Assertions.assertDoesNotThrow(() -> { ... })`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RunnerToExtension,JUnit 4 `@RunWith` to JUnit Jupiter `@ExtendWith`,Replace runners with the JUnit Jupiter extension equivalent.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,"[{""name"":""runners"",""type"":""List"",""displayName"":""Runners"",""description"":""The fully qualified class names of the JUnit 4 runners to replace. Sometimes several runners are replaced by a single JUnit Jupiter extension."",""example"":""[ org.springframework.test.context.junit4.SpringRunner ]"",""required"":true},{""name"":""extension"",""type"":""String"",""displayName"":""Extension"",""description"":""The fully qualified class names of the JUnit Jupiter extension."",""example"":""org.springframework.test.context.junit.jupiter.SpringExtension"",""required"":true}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TempDirNonFinal,Make `@TempDir` fields non final,Make JUnit 5's `org.junit.jupiter.api.io.TempDir` fields non final.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TemporaryFolderToTempDir,Use JUnit Jupiter `@TempDir`,Translates JUnit 4's `org.junit.rules.TemporaryFolder` into JUnit 5's `org.junit.jupiter.api.io.TempDir`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TestRuleToTestInfo,JUnit TestName @Rule to JUnit Jupiter TestInfo,Replace usages of JUnit 4's `@Rule TestName` with JUnit 5's TestInfo.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TimeoutRuleToClassAnnotation,JUnit 4 `@Rule Timeout` to JUnit Jupiter's `Timeout`,Replace usages of JUnit 4's `@Rule Timeout` with JUnit 5 `Timeout` class annotation.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateBeforeAfterAnnotations,Migrate JUnit 4 lifecycle annotations to JUnit Jupiter,"Replace JUnit 4's `@Before`, `@BeforeClass`, `@After`, and `@AfterClass` annotations with their JUnit Jupiter equivalents.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateMockWebServer,OkHttp 3.x `MockWebServer` `@Rule` To 4.x `MockWebServer`,Replace usages of okhttp3 3.x `@Rule` MockWebServer with 4.x `MockWebServer`.,3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateMockWebServerMockResponse,OkHttp `MockWebServer` `MockResponse` to 5.x `MockWebServer3` `MockResponse`,Replace usages of OkHttp MockWebServer `MockResponse` with 5.x MockWebServer3 `MockResponse` and it's `Builder`.,61,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateTestAnnotation,Migrate JUnit 4 `@Test` annotations to JUnit 5,Update usages of JUnit 4's `@org.junit.Test` annotation to JUnit 5's `org.junit.jupiter.api.Test` annotation.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseAssertSame,Use JUnit5's `assertSame` or `assertNotSame` instead of `assertTrue(... == ...)`,Prefers the usage of `assertSame` or `assertNotSame` methods instead of using of vanilla `assertTrue` or `assertFalse` with a boolean comparison.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseTestMethodOrder,Migrate from JUnit 4 `@FixedMethodOrder` to JUnit 5 `@TestMethodOrder`,JUnit optionally allows test method execution order to be specified. This replaces JUnit 4 test execution ordering annotations with JUnit 5 replacements.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseWiremockExtension,Use wiremock extension,"As of 2.31.0, wiremock [supports JUnit 5](https://wiremock.org/docs/junit-jupiter/) via an extension.",3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddHamcrestJUnitDependency,Add Hamcrest JUnit dependency,Add Hamcrest JUnit dependency only if JUnit 4's `assertThat` or `assumeThat` is used.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddJupiterDependencies,Add JUnit Jupiter dependencies,"Adds JUnit Jupiter dependencies to a Maven or Gradle project. JUnit Jupiter can be added either with the artifact `junit-jupiter`, or both of `junit-jupiter-api` and `junit-jupiter-engine`. This adds `junit-jupiter` dependency unless `junit-jupiter-api` or `junit-jupiter-engine` are already present.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.JUnit5BestPractices,JUnit 5 best practices,Applies best practices to tests.,465,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.StaticImports,Statically import JUnit Jupiter assertions,Always use a static import for assertion methods.,3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.JUnit4to5Migration,JUnit Jupiter migration from JUnit 4.x,Migrates JUnit 4.x tests to JUnit Jupiter.,329,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ExcludeJUnit4UnlessUsingTestcontainers,"Exclude JUnit 4, unless Testcontainers is used","Excludes JUnit 4, as it ought not to be necessary in a JUnit 5 project, unless Testcontainers is used.",5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseHamcrestAssertThat,Use `MatcherAssert#assertThat(..)`,JUnit 4's `Assert#assertThat(..)` This method was deprecated in JUnit 4 and removed in JUnit Jupiter.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MigrateAssumptions,Use `Assertions#assume*(..)` and Hamcrest's `MatcherAssume#assume*(..)`,Many of JUnit 4's `Assume#assume(..)` methods have no direct counterpart in JUnit 5 and require Hamcrest JUnit's `MatcherAssume`.,13,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseMockitoExtension,Use Mockito JUnit Jupiter extension,Migrate uses of `@RunWith(MockitoJUnitRunner.class)` (and similar annotations) to `@ExtendWith(MockitoExtension.class)`.,107,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.IgnoreToDisabled,Use JUnit Jupiter `@Disabled`,Migrates JUnit 4.x `@Ignore` to JUnit Jupiter `@Disabled`.,3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ThrowingRunnableToExecutable,Use JUnit Jupiter `Executable`,Migrates JUnit 4.x `ThrowingRunnable` to JUnit Jupiter `Executable`.,3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.VertxUnitToVertxJunit5,Use Vert.x JUnit 5 Extension,Migrates Vert.x `@RunWith` `VertxUnitRunner` to the JUnit Jupiter `@ExtendWith` `VertxExtension`.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeOkHttpMockWebServer,Use OkHttp 3 MockWebServer for JUnit 5,Migrates OkHttp 3 `MockWebServer` to enable JUnit Jupiter Extension support.,65,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CleanupAssertions,Clean Up Assertions,Simplifies JUnit Jupiter assertions to their most-direct equivalents.,23,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseXMLUnitLegacy,Use XMLUnit Legacy for JUnit 5,Migrates XMLUnit 1.x to XMLUnit legacy 2.x.,3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeSurefirePlugin,Upgrade Surefire Plugin,Upgrades the Maven Surefire Plugin to the latest version if still using an older Maven version.,7,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeToJUnit513,Upgrade to JUnit 5.13,Upgrades JUnit 5 to 5.13.x and migrates all deprecated APIs.,23,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeToJUnit514,Upgrade to JUnit 5.14,Upgrades JUnit 5 to 5.14.x and migrates all deprecated APIs.,47,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit6.MigrateMethodOrdererAlphanumeric,Migrate `MethodOrderer.Alphanumeric` to `MethodOrderer.MethodName`,JUnit 6 removed the `MethodOrderer.Alphanumeric` class. This recipe migrates usages to `MethodOrderer.MethodName` which provides similar functionality.,1,Junit6,Testing,Java,,,Basic building blocks for transforming Java code., +ecosystem,packageName,name,displayName,description,recipeCount,category1,category2,category3,category1Description,category2Description,category3Description,options,dataTables +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.arquillian.ReplaceArquillianInSequenceAnnotation,Arquillian JUnit 4 `@InSequence` to JUnit Jupiter `@Order`,Transforms the Arquillian JUnit 4 `@InSequence` to the JUnit Jupiter `@Order`.,1,Arquillian,Testing,Java,Recipes for [Arquillian](https://arquillian.org/) integration testing framework.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.arquillian.ArquillianJUnit4ToArquillianJUnit5,Use Arquillian JUnit 5 Extension,Migrates Arquillian JUnit 4 to JUnit 5.,11,Arquillian,Testing,Java,Recipes for [Arquillian](https://arquillian.org/) integration testing framework.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions,Adopt AssertJ Duration assertions,Adopt AssertJ `DurationAssert` assertions for more expressive messages.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes,Adopt AssertJ BigInteger Assertions,Adopt AssertJ BigInteger Assertions. Favor semantically explicit methods (e.g. `myBigInteger.isZero()` over `myBigInteger.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes,Adopt AssertJ Byte Assertions,Adopt AssertJ Byte Assertions. Favor semantically explicit methods (e.g. `myByte.isZero()` over `myByte.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes,Adopt AssertJ Double Assertions,Adopt AssertJ Double Assertions. Favor semantically explicit methods (e.g. `myDouble.isZero()` over `myDouble.isEqualTo(0.0)`).,13,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsCloseToWithOffsetRecipe,Replace `isEqualTo` with `isCloseTo`,Replace `isEqualTo` with `isCloseTo` when `offset` or `percentage` is provided.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes,Adopt AssertJ Float Assertions,Adopt AssertJ Float Assertions. Favor semantically explicit methods (e.g. `myFloat.isZero()` over `myFloat.isEqualTo(0.0f)`).,13,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsCloseToWithOffsetRecipe,Replace `isEqualTo` with `isCloseTo`,Replace `isEqualTo` with `isCloseTo` when `offset` or `percentage` is provided.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes,Adopt AssertJ Integer Assertions,Adopt AssertJ Integer Assertions. Favor semantically explicit methods (e.g. `myInteger.isZero()` over `myInteger.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes,Adopt AssertJ Long Assertions,Adopt AssertJ Long Assertions. Favor semantically explicit methods (e.g. `myLong.isZero()` over `myLong.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes,Adopt AssertJ Short Assertions,Adopt AssertJ Short Assertions. Favor semantically explicit methods (e.g. `myShort.isZero()` over `myShort.isEqualTo(0)`).,11,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsEqualToRecipe,Replace `isCloseTo` with `isEqualTo`,Replace `isCloseTo` with `isEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsNotEqualToRecipe,Replace `isNotCloseTo` with `isNotEqualTo`,Replace `isNotCloseTo` with `isNotEqualTo` when `offset` or `percentage` is zero.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsNotZeroRecipe,Replace `isNotEqualTo(0)` with `isNotZero()`,Replace `isNotEqualTo(0)` with `isNotZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsOneRecipe,Replace `isEqualTo(1)` with `isOne()`,Replace `isEqualTo(1)` with `isOne()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsZeroRecipe,Replace `isEqualTo(0)` with `isZero()`,Replace `isEqualTo(0)` with `isZero()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.CollapseConsecutiveAssertThatStatements,Collapse consecutive `assertThat` statements,Collapse consecutive `assertThat` statements into single `assertThat` chained statement. This recipe ignores `assertThat` statements that have method invocation as parameter.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.IsEqualToIgnoringMillisToIsCloseToRecipe,"Replace `AbstractDateAssert#isEqualToIgnoringMillis(java.util.Date)` by `by isCloseTo(Date, long)`",`isEqualToIgnoringMillis()` is deprecated in favor of `isCloseTo()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertArrayEqualsToAssertThat,JUnit `assertArrayEquals` to assertJ,Convert JUnit-style `assertArrayEquals()` to AssertJ's `assertThat().contains()` equivalents.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertEqualsToAssertThat,JUnit `assertEquals` to AssertJ,Convert JUnit-style `assertEquals()` to AssertJ's `assertThat().isEqualTo()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertFalseToAssertThat,JUnit `assertFalse` to AssertJ,Convert JUnit-style `assertFalse()` to AssertJ's `assertThat().isFalse()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertInstanceOfToAssertThat,JUnit `assertInstanceOf` to AssertJ,Convert JUnit-style `assertInstanceOf()` to AssertJ's `assertThat().isInstanceOf()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertNotEqualsToAssertThat,JUnit `assertNotEquals` to AssertJ,Convert JUnit-style `assertNotEquals()` to AssertJ's `assertThat().isNotEqualTo()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertNotNullToAssertThat,JUnit `assertNotNull` to AssertJ,Convert JUnit-style `assertNotNull()` to AssertJ's `assertThat().isNotNull()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertNullToAssertThat,JUnit `assertNull` to AssertJ,Convert JUnit-style `assertNull()` to AssertJ's `assertThat().isNull()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertSameToAssertThat,JUnit `assertSame` to AssertJ,Convert JUnit-style `assertSame()` to AssertJ's `assertThat().isSameAs()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertThrowsToAssertExceptionType,JUnit AssertThrows to AssertJ exceptionType,Convert `JUnit#AssertThrows` to `AssertJ#assertThatExceptionOfType` to allow for chained assertions on the thrown exception.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitAssertTrueToAssertThat,JUnit `assertTrue` to AssertJ,Convert JUnit-style `assertTrue()` to AssertJ's `assertThat().isTrue()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitFailToAssertJFail,JUnit fail to AssertJ,Convert JUnit-style `fail()` to AssertJ's `fail()`.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitTryFailToAssertThatThrownBy,Convert try-catch-fail blocks to AssertJ's assertThatThrownBy,"Replace try-catch blocks where the try block ends with a `fail()` statement and the catch block optionally contains assertions, with AssertJ's `assertThatThrownBy()`.",1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.ReturnActual,Collapse `assertThat` followed by `return` into single statement,Collapse an `assertThat` statement followed by a `return` of the same object into a single `return assertThat(...).assertions().actual()` statement.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyAssertJAssertion,Simplify AssertJ assertions with literal arguments,Simplify AssertJ assertions by replacing them with more expressive dedicated assertions.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""assertToReplace"",""type"":""String"",""displayName"":""AssertJ assertion"",""description"":""The assertion method that should be replaced."",""example"":""hasSize""},{""name"":""literalArgument"",""type"":""String"",""displayName"":""Assertion argument literal"",""description"":""The literal argument passed into the assertion to replace; use \""null\"" for `null`."",""example"":""0"",""required"":true},{""name"":""dedicatedAssertion"",""type"":""String"",""displayName"":""Dedicated assertion"",""description"":""The zero argument assertion to adopt instead."",""example"":""isEmpty"",""required"":true},{""name"":""requiredType"",""type"":""String"",""displayName"":""Required type"",""description"":""The type of the actual assertion argument."",""example"":""java.lang.String"",""required"":true}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion,Simplify AssertJ chained assertions,Many AssertJ chained assertions have dedicated assertions that function the same. It is best to use the dedicated assertions.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""chainedAssertion"",""type"":""String"",""displayName"":""AssertJ chained assertion"",""description"":""The chained AssertJ assertion to move to dedicated assertion."",""example"":""equals""},{""name"":""assertToReplace"",""type"":""String"",""displayName"":""AssertJ replaced assertion"",""description"":""The AssertJ assert that should be replaced."",""example"":""isTrue""},{""name"":""dedicatedAssertion"",""type"":""String"",""displayName"":""AssertJ replacement assertion"",""description"":""The AssertJ method to migrate to."",""example"":""isEqualTo""},{""name"":""requiredType"",""type"":""String"",""displayName"":""Required type"",""description"":""The type of the actual assertion argument."",""example"":""java.lang.String""}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyHasSizeAssertion,Simplify AssertJ assertions with `hasSize` argument,Simplify AssertJ assertions by replacing `hasSize` with `hasSameSizeAs` dedicated assertions.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyRedundantAssertJChains,Simplify redundant AssertJ assertion chains,Removes redundant AssertJ assertions when chained methods already provide the same or stronger guarantees.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifySequencedCollectionAssertions,Simplify AssertJ assertions on SequencedCollection,"Simplify AssertJ assertions on SequencedCollection by using dedicated assertion methods. For example, `assertThat(sequencedCollection.getLast())` can be simplified to `assertThat(sequencedCollection).last()`.",1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyStreamMapToExtracting,Simplify `assertThat(collection.stream().map(...))` to `assertThat(collection).extracting(...)`,Simplifies AssertJ assertions that use `stream().map()` to extract values from a collection by using the dedicated `extracting()` method instead. This makes the assertion more readable and leverages AssertJ's built-in extraction capabilities.,1,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.Assertj,AssertJ best practices,Migrates JUnit asserts to AssertJ and applies best practices to assertions.,1777,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.StaticImports,Statically import AssertJ's `assertThat`,Consistently use a static import rather than inlining the `Assertions` class name in tests.,7,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertions,Simplify AssertJ chained assertions,Replace AssertJ assertions where a method is called on the actual value with a dedicated assertion.,127,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.SimplifyAssertJAssertions,Shorten AssertJ assertions,Replace AssertJ assertions where a dedicated assertion is available for the same actual value.,19,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.JUnitToAssertj,Migrate JUnit asserts to AssertJ,"AssertJ provides a rich set of assertions, truly helpful error messages, improves test code readability. Converts assertions from `org.junit.jupiter.api.Assertions` to `org.assertj.core.api.Assertions`. Will convert JUnit 4 to JUnit Jupiter if necessary to match and modify assertions.",681,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.FestToAssertj,Migrate Fest 2.x to AssertJ,"AssertJ provides a rich set of assertions, truly helpful error messages, improves test code readability. Converts Fest 2.x imports to AssertJ imports.",21,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsBooleanToAssertBoolean,"Replace JUnit `assertEquals(false, )` to `assertFalse()` / `assertTrue()`",Using `assertFalse` or `assertTrue` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsNullToAssertNull,"`assertEquals(a, null)` to `assertNull(a)`",Using `assertNull(a)` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseEqualsToAssertNotEquals,"Replace JUnit `assertFalse(a.equals(b))` to `assertNotEquals(a,b)`","Using `assertNotEquals(a,b)` is simpler and more clear.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseNegationToAssertTrue,Replace JUnit `assertFalse(!)` to `assertTrue()`,Using `assertTrue` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseNullToAssertNotNull,Replace JUnit `assertFalse(a == null)` to `assertNotNull(a)`,Using `assertNotNull(a)` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanRemovedRecipe,Remove JUnit `assertTrue(true)` and `assertFalse(false)`,These assertions are redundant and do not provide any value. They can be safely removed.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipes,Replace JUnit `assertTrue(false)` and `assertFalse(true)` with `fail()`,Using fail is more direct and clear.,5,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipes$WithMessageRecipe,"Replace JUnit `assertTrue(false, ""reason"")` and `assertFalse(true, ""reason"")` with `fail(""reason"")`",Using fail is more direct and clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipes$WithoutMessageRecipe,Replace JUnit `assertTrue(false)` and `assertFalse(true)` with `fail()`,Using fail is more direct and clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertNotEqualsBooleanToAssertBoolean,"Replace JUnit `assertNotEquals(false, )` to `assertFalse()` / `assertTrue()`",Using `assertFalse` or `assertTrue` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueComparisonToAssertEquals,"Junit `assertTrue(a == b)` to `assertEquals(a,b)`","Using `assertEquals(a,b)` is simpler and more clear.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueEqualsToAssertEquals,"Replace JUnit `assertTrue(a.equals(b))` to `assertEquals(a,b)`","Using `assertEquals(a,b)` is simpler and more clear.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueNegationToAssertFalse,Replace JUnit `assertTrue(!)` to `assertFalse()`,Using `assertFalse` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertTrueNullToAssertNull,Replace JUnit `assertTrue(a == null)` to `assertNull(a)`,Using `assertNull(a)` is simpler and more clear.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertionsArgumentOrder,Assertion arguments should be passed in the correct order,"Assertions such as `org.junit.Assert.assertEquals` expect the first argument to be the expected value and the second argument to be the actual value; for `org.testng.Assert`, it’s the other way around. This recipe detects `J.Literal`, `J.NewArray`, and `java.util.Iterable` arguments swapping them if necessary so that the error messages won't be confusing.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.KotlinTestMethodsShouldReturnUnit,Kotlin test methods should have return type `Unit`,"Kotlin test methods annotated with `@Test`, `@ParameterizedTest`, `@RepeatedTest`, `@TestTemplate` should have `Unit` return type. Other return types can cause test discovery issues, and warnings as of JUnit 5.13+. This recipe changes the return type to `Unit` and removes `return` statements.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.RemoveEmptyTests,Remove empty tests without comments,Removes empty methods with a `@Test` annotation if the body does not have comments.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.RemoveTestPrefix,Remove `test` prefix from JUnit 5 tests,"Remove `test` from methods with `@Test`, `@ParameterizedTest`, `@RepeatedTest` or `@TestFactory`. They no longer have to prefix test to be usable by JUnit 5.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.SimplifyTestThrows,Simplify `throws` statements of tests,Replace all thrown exception classes of test method signatures by `Exception`.,1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.TestMethodsShouldBeVoid,Test methods should have void return type,"Test methods annotated with `@Test`, `@ParameterizedTest`, `@RepeatedTest`, `@TestTemplate` should have `void` return type. Non-void return types can cause test discovery issues, and warnings as of JUnit 5.13+. This recipe changes the return type to `void` and removes `return` statements.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.TestsShouldIncludeAssertions,Include an assertion in tests,"For tests not having any assertions, wrap the statements with JUnit Jupiter's `Assertions#assertDoesNotThrow(..)`.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""additionalAsserts"",""type"":""String"",""displayName"":""Additional assertions"",""description"":""A comma delimited list of packages and/or classes that will be identified as assertions. I.E. a common assertion utility `org.foo.TestUtil`."",""example"":""org.foo.TestUtil, org.bar""}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.TestsShouldNotBePublic,Remove `public` visibility of JUnit 5 tests,"Remove `public` and optionally `protected` modifiers from methods with `@Test`, `@ParameterizedTest`, `@RepeatedTest`, `@TestFactory`, `@BeforeEach`, `@AfterEach`, `@BeforeAll`, or `@AfterAll`. They no longer have to be public visibility to be usable by JUnit 5.",1,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""removeProtectedModifiers"",""type"":""Boolean"",""displayName"":""Remove protected modifiers"",""description"":""Also remove protected modifiers from test methods"",""example"":""true""}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.BestPractices,Testing best practices,Applies best practices to tests.,7,Cleanup,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.dbrider.ExecutionListenerToDbRiderAnnotation,Migrate the `DBRiderTestExecutionListener` to the `@DBRider` annotation,Migrate the `DBRiderTestExecutionListener` to the `@DBRider` annotation. This recipe is useful when migrating from JUnit 4 `dbrider-spring` to JUnit 5 `dbrider-junit5`.,1,DBRider,Testing,Java,Recipes for [DBRider](https://database-rider.github.io/database-rider/) database testing framework.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.dbrider.MigrateDbRiderSpringToDbRiderJUnit5,Migrate rider-spring (JUnit4) to rider-junit5 (JUnit5),This recipe will migrate the necessary dependencies and annotations from DbRider with JUnit4 to JUnit5 in a Spring application.,7,DBRider,Testing,Java,Recipes for [DBRider](https://database-rider.github.io/database-rider/) database testing framework.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.easymock.EasyMockVerifyToMockitoVerify,Replace EasyMock `verify` calls with Mockito `verify` calls,Replace `EasyMock.verify(dependency)` with individual `Mockito.verify(dependency).method()` calls based on expected methods.,1,EasyMock,Testing,Java,Recipes for migrating from [EasyMock](https://easymock.org/) to Mockito.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.easymock.RemoveExtendsEasyMockSupport,Migrate Test classes that extend `org.easymock.EasyMockSupport` to use Mockito,Modify test classes by removing extends EasyMockSupport and replacing EasyMock methods with Mockito equivalents.,1,EasyMock,Testing,Java,Recipes for migrating from [EasyMock](https://easymock.org/) to Mockito.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.easymock.EasyMockToMockito,Migrate from EasyMock to Mockito,This recipe will apply changes commonly needed when migrating from EasyMock to Mockito.,337,EasyMock,Testing,Java,Recipes for migrating from [EasyMock](https://easymock.org/) to Mockito.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.AssertThatBooleanToAssertJ,"Migrate Hamcrest `assertThat(boolean, Matcher)` to AssertJ","Replace Hamcrest `assertThat(String, boolean)` with AssertJ `assertThat(boolean).as(String).isTrue()`.",1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestEveryItemToAssertJ,Migrate Hamcrest `everyItem` to AssertJ,Migrate Hamcrest `everyItem` to AssertJ `allSatisfy` or `hasOnlyElementsOfType`.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestHasItemMatcherToAssertJ,Migrate Hamcrest `hasItem(Matcher)` to AssertJ,Migrate Hamcrest `hasItem(Matcher)` to AssertJ `hasAtLeastOneElementOfType` or `anySatisfy`.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestHasPropertyToAssertJ,Migrate Hamcrest `hasProperty` to AssertJ,Migrate Hamcrest `hasProperty` to AssertJ `hasFieldOrProperty` and `hasFieldOrPropertyWithValue`.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestInstanceOfToJUnit5,Migrate from Hamcrest `instanceOf` matcher to JUnit 5,Migrate from Hamcrest `instanceOf` and `isA` matcher to JUnit5 `assertInstanceOf` assertion.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestIsMatcherToAssertJ,Migrate Hamcrest `is(Object)` to AssertJ,Migrate Hamcrest `is(Object)` to AssertJ `Assertions.assertThat(..)`.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestMatcherToAssertJ,Migrate from Hamcrest `Matcher` to AssertJ,Migrate from Hamcrest `Matcher` to AssertJ assertions.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,"[{""name"":""matcher"",""type"":""String"",""displayName"":""Hamcrest matcher"",""description"":""The Hamcrest `Matcher` to migrate to JUnit5."",""example"":""equalTo""},{""name"":""assertion"",""type"":""String"",""displayName"":""AssertJ assertion"",""description"":""The AssertJ method to migrate to."",""example"":""isEqualTo""},{""name"":""argumentType"",""type"":""String"",""displayName"":""Argument type"",""description"":""The type of the argument to the Hamcrest `Matcher`."",""example"":""java.math.BigDecimal""}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestMatcherToJUnit5,Migrate from Hamcrest `Matcher` to JUnit 5,Migrate from Hamcrest `Matcher` to JUnit 5 assertions.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestNotMatcherToAssertJ,Migrate Hamcrest `not(Matcher)` to AssertJ,Migrate from Hamcrest `not(Matcher)` to AssertJ assertions.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,"[{""name"":""notMatcher"",""type"":""String"",""displayName"":""Hamcrest Matcher"",""description"":""The Hamcrest `not(Matcher)` to migrate to JUnit5."",""example"":""equalTo""},{""name"":""assertion"",""type"":""String"",""displayName"":""AssertJ Assertion"",""description"":""The AssertJ method to migrate to."",""example"":""isNotEqualTo""}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.HamcrestOfMatchersToAssertJ,Migrate `anyOf` Hamcrest Matcher to AssertJ,Migrate the `anyOf` Hamcrest Matcher to AssertJ's `satisfiesAnyOf` assertion.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.RemoveIsMatcher,Remove Hamcrest `is(Matcher)`,Remove Hamcrest `is(Matcher)` ahead of migration.,1,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.AddHamcrestIfUsed,Add `org.hamcrest:hamcrest` if it is used,"JUnit Jupiter does not include hamcrest as a transitive dependency. If needed, add a direct dependency.",5,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.ConsistentHamcrestMatcherImports,Use consistent Hamcrest matcher imports,"Use consistent imports for Hamcrest matchers, and remove wrapping `is(Matcher)` calls ahead of further changes.",9,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.MigrateHamcrestToJUnit5,Migrate Hamcrest assertions to JUnit Jupiter,Migrate Hamcrest `assertThat(..)` to JUnit Jupiter `Assertions`.,23,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ,Migrate Hamcrest assertions to AssertJ,Migrate Hamcrest `assertThat(..)` to AssertJ `Assertions`.,181,Hamcrest,Testing,Java,Recipes for migrating from [Hamcrest](http://hamcrest.org/) matchers to AssertJ.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitAnnotatedArgumentToMockito,Convert JMockit `@Mocked` and `@Injectable` annotated arguments,Convert JMockit `@Mocked` and `@Injectable` annotated arguments into Mockito statements.,1,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitBlockToMockito,"Rewrite JMockit Expectations, NonStrictExpectations, Verifications, VerificationsInOrder, FullVerifications","Rewrites JMockit `Expectations, NonStrictExpectations, Verifications, VerificationsInOrder, FullVerifications` blocks to Mockito statements.",1,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitMockUpToMockito,Rewrite JMockit MockUp to Mockito statements,Rewrites JMockit `MockUp` blocks to Mockito statements. This recipe will not rewrite private methods in MockUp.,1,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.jmockit.JMockitToMockito,Migrate from JMockit to Mockito,This recipe will apply changes commonly needed when migrating from JMockit to Mockito.,269,JMockit,Testing,Java,Recipes for migrating from [JMockit](https://jmockit.github.io/) to Mockito.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddMissingNested,JUnit 5 inner test classes should be annotated with `@Nested`,Adds `@Nested` to inner classes that contain JUnit 5 tests.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddMissingTestBeforeAfterAnnotations,"Add missing `@BeforeEach`, `@AfterEach`, `@Test` to overriding methods","Adds `@BeforeEach`, `@AfterEach`, `@Test` to methods overriding superclass methods if the annotations are present on the superclass method.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddParameterizedTestAnnotation,Add missing `@ParameterizedTest` annotation when `@ValueSource` is used or replace `@Test` with `@ParameterizedTest`,Add missing `@ParameterizedTest` annotation when `@ValueSource` is used or replace `@Test` with `@ParameterizedTest`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssertThrowsOnLastStatement,Applies JUnit 5 `assertThrows` on last statement in lambda block only,"Applies JUnit 5 `assertThrows` on last statement in lambda block only. In rare cases may cause compilation errors if the lambda uses effectively non final variables. In some cases, tests might fail if earlier statements in the lambda block throw exceptions.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssertToAssertions,JUnit 4 `Assert` To JUnit Jupiter `Assertions`,Change JUnit 4's `org.junit.Assert` into JUnit Jupiter's `org.junit.jupiter.api.Assertions`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssertTrueInstanceofToAssertInstanceOf,"`assertTrue(x instanceof y)` to `assertInstanceOf(y.class, x)`","Migration of JUnit4 (or potentially JUnit5) test case in form of assertTrue(x instanceof y) to assertInstanceOf(y.class, x).",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssumeNotNullToAssumptionsRecipes,Transform `Assume` methods to `Assumptions`,Transform `Assume` methods without a direct counterpart to equivalent assumptions in `Assumptions`.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssumeNotNullToAssumptionsRecipes$SingleArgRecipe,Transform singlar `assumeNotNull(object)` to `assumeFalse(object == null)`,Transform singlar `Assume.assumeNotNull(object)` to `Assumptions.assumeFalse(object == null)`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AssumeNotNullToAssumptionsRecipes$VarArgsRecipe,Transform variadic `assumeNotNull(objects...)` to a stream of `assumeFalse(object == null)`,"Transform `Assume.assumeNotNull(objects...)` to `Stream.of(object1, object2).forEach(o -> Assumptions.assumeFalse(o == null))`.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CategoryToTag,JUnit 4 `@Category` to JUnit Jupiter `@Tag`,"Transforms the JUnit 4 `@Category`, which can list multiple categories, into one `@Tag` annotation per category listed.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CleanupJUnitImports,Cleanup JUnit imports,Removes unused `org.junit` import symbols.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CleanupKotlinJUnit5AssertionImports,Remove JUnit 5 static Assertions imports in Kotlin when wildcard import is present,"In Kotlin, when both `import org.junit.jupiter.api.*` and static imports from `org.junit.jupiter.api.Assertions` are present, there is overload resolution ambiguity between the Java static methods and the Kotlin extension functions. This recipe removes the static Assertions imports when the wildcard import is present, allowing the Kotlin extension functions to be used instead.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CsvSourceToValueSource,Replace `@CsvSource` with `@ValueSource` for single method arguments,Replaces JUnit 5's `@CsvSource` annotation with `@ValueSource` when the parameterized test has only a single method argument.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.EnclosedToNested,JUnit 4 `@RunWith(Enclosed.class)` to JUnit Jupiter `@Nested`,"Removes the `Enclosed` specification from a class, with `Nested` added to its inner classes by `AddMissingNested`.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.EnvironmentVariables,Migrate JUnit 4 environmentVariables rule to JUnit 5 system stubs extension,Replaces usage of the JUnit 4 `@Rule EnvironmentVariables` with the JUnit 5-compatible `SystemStubsExtension` and `@SystemStub EnvironmentVariables` from the System Stubs library.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ExpectedExceptionToAssertThrows,JUnit 4 `ExpectedException` To JUnit Jupiter's `assertThrows()`,Replace usages of JUnit 4's `@Rule ExpectedException` with JUnit 5's `Assertions.assertThrows()`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.GradleUseJunitJupiter,Gradle `Test` use JUnit Jupiter,By default Gradle's `Test` tasks use JUnit 4. Gradle `Test` tasks must be configured with `useJUnitPlatform()` to run JUnit Jupiter tests. This recipe adds the `useJUnitPlatform()` method call to the `Test` task configuration.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.HandleExternalResourceRules,Handle the usage of ExternalResourceRule fields using @ExtendWith(ExternalResourceSupport.class),Handles the usage of the ExternalResourceRule fields by adding the @ExtendWith(ExternalResourceSupport.class) annotation to the test class.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.JUnitParamsRunnerToParameterized,Pragmatists `@RunWith(JUnitParamsRunner.class)` to JUnit Jupiter `@Parameterized` tests,Convert Pragmatists Parameterized test to the JUnit Jupiter ParameterizedTest equivalent.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.LifecycleNonPrivate,Make lifecycle methods non private,"Make JUnit 5's `@AfterAll`, `@AfterEach`, `@BeforeAll` and `@BeforeEach` non private.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MigrateJUnitTestCase,Migrate JUnit 4 `TestCase` to JUnit Jupiter,Convert JUnit 4 `TestCase` to JUnit Jupiter.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MockitoJUnitToMockitoExtension,JUnit 4 `MockitoJUnit` to JUnit Jupiter `MockitoExtension`,Replaces `MockitoJUnit` rules with `MockitoExtension`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ParameterizedRunnerToParameterized,JUnit 4 `@RunWith(Parameterized.class)` to JUnit Jupiter parameterized tests,Convert JUnit 4 parameterized runner the JUnit Jupiter parameterized test equivalent.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RemoveDuplicateTestTemplates,Remove duplicates uses of @TestTemplate implementations for a single method,Remove duplicates uses of @TestTemplate implementations for a single method.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RemoveObsoleteRunners,Remove JUnit 4 `@RunWith` annotations that do not require an `@ExtendsWith` replacement,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.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,"[{""name"":""obsoleteRunners"",""type"":""List"",""displayName"":""Obsolete Runners"",""description"":""The fully qualified class names of the JUnit 4 runners to be removed."",""example"":""org.junit.runners.JUnit4"",""required"":true}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RemoveTryCatchFailBlocks,Replace `fail()` in `try-catch` blocks with `Assertions.assertDoesNotThrow(() -> { ... })`,Replace `try-catch` blocks where `catch` merely contains a `fail()` for `fail(String)` statement with `Assertions.assertDoesNotThrow(() -> { ... })`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.RunnerToExtension,JUnit 4 `@RunWith` to JUnit Jupiter `@ExtendWith`,Replace runners with the JUnit Jupiter extension equivalent.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,"[{""name"":""runners"",""type"":""List"",""displayName"":""Runners"",""description"":""The fully qualified class names of the JUnit 4 runners to replace. Sometimes several runners are replaced by a single JUnit Jupiter extension."",""example"":""[ org.springframework.test.context.junit4.SpringRunner ]"",""required"":true},{""name"":""extension"",""type"":""String"",""displayName"":""Extension"",""description"":""The fully qualified class names of the JUnit Jupiter extension."",""example"":""org.springframework.test.context.junit.jupiter.SpringExtension"",""required"":true}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TempDirNonFinal,Make `@TempDir` fields non final,Make JUnit 5's `org.junit.jupiter.api.io.TempDir` fields non final.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TemporaryFolderToTempDir,Use JUnit Jupiter `@TempDir`,Translates JUnit 4's `org.junit.rules.TemporaryFolder` into JUnit 5's `org.junit.jupiter.api.io.TempDir`.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TestRuleToTestInfo,JUnit TestName @Rule to JUnit Jupiter TestInfo,Replace usages of JUnit 4's `@Rule TestName` with JUnit 5's TestInfo.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.TimeoutRuleToClassAnnotation,JUnit 4 `@Rule Timeout` to JUnit Jupiter's `Timeout`,Replace usages of JUnit 4's `@Rule Timeout` with JUnit 5 `Timeout` class annotation.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateBeforeAfterAnnotations,Migrate JUnit 4 lifecycle annotations to JUnit Jupiter,"Replace JUnit 4's `@Before`, `@BeforeClass`, `@After`, and `@AfterClass` annotations with their JUnit Jupiter equivalents.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateMockWebServer,OkHttp 3.x `MockWebServer` `@Rule` To 4.x `MockWebServer`,Replace usages of okhttp3 3.x `@Rule` MockWebServer with 4.x `MockWebServer`.,3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateMockWebServerMockResponse,OkHttp `MockWebServer` `MockResponse` to 5.x `MockWebServer3` `MockResponse`,Replace usages of OkHttp MockWebServer `MockResponse` with 5.x MockWebServer3 `MockResponse` and it's `Builder`.,61,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpdateTestAnnotation,Migrate JUnit 4 `@Test` annotations to JUnit 5,Update usages of JUnit 4's `@org.junit.Test` annotation to JUnit 5's `org.junit.jupiter.api.Test` annotation.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseAssertSame,Use JUnit5's `assertSame` or `assertNotSame` instead of `assertTrue(... == ...)`,Prefers the usage of `assertSame` or `assertNotSame` methods instead of using of vanilla `assertTrue` or `assertFalse` with a boolean comparison.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseTestMethodOrder,Migrate from JUnit 4 `@FixedMethodOrder` to JUnit 5 `@TestMethodOrder`,JUnit optionally allows test method execution order to be specified. This replaces JUnit 4 test execution ordering annotations with JUnit 5 replacements.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseWiremockExtension,Use wiremock extension,"As of 2.31.0, wiremock [supports JUnit 5](https://wiremock.org/docs/junit-jupiter/) via an extension.",3,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddHamcrestJUnitDependency,Add Hamcrest JUnit dependency,Add Hamcrest JUnit dependency only if JUnit 4's `assertThat` or `assumeThat` is used.,1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.AddJupiterDependencies,Add JUnit Jupiter dependencies,"Adds JUnit Jupiter dependencies to a Maven or Gradle project. JUnit Jupiter can be added either with the artifact `junit-jupiter`, or both of `junit-jupiter-api` and `junit-jupiter-engine`. This adds `junit-jupiter` dependency unless `junit-jupiter-api` or `junit-jupiter-engine` are already present.",1,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.JUnit5BestPractices,JUnit 5 best practices,Applies best practices to tests.,515,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.StaticImports,Statically import JUnit Jupiter assertions,Always use a static import for assertion methods.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.JUnit4to5Migration,JUnit Jupiter migration from JUnit 4.x,Migrates JUnit 4.x tests to JUnit Jupiter.,363,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ExcludeJUnit4UnlessUsingTestcontainers,"Exclude JUnit 4, unless Testcontainers is used","Excludes JUnit 4, as it ought not to be necessary in a JUnit 5 project, unless Testcontainers is used.",5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseHamcrestAssertThat,Use `MatcherAssert#assertThat(..)`,JUnit 4's `Assert#assertThat(..)` This method was deprecated in JUnit 4 and removed in JUnit Jupiter.,7,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MigrateAssumptions,Use `Assertions#assume*(..)` and Hamcrest's `MatcherAssume#assume*(..)`,Many of JUnit 4's `Assume#assume(..)` methods have no direct counterpart in JUnit 5 and require Hamcrest JUnit's `MatcherAssume`.,15,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseMockitoExtension,Use Mockito JUnit Jupiter extension,Migrate uses of `@RunWith(MockitoJUnitRunner.class)` (and similar annotations) to `@ExtendWith(MockitoExtension.class)`.,115,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.IgnoreToDisabled,Use JUnit Jupiter `@Disabled`,Migrates JUnit 4.x `@Ignore` to JUnit Jupiter `@Disabled`.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.ThrowingRunnableToExecutable,Use JUnit Jupiter `Executable`,Migrates JUnit 4.x `ThrowingRunnable` to JUnit Jupiter `Executable`.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.MigrateAssertionFailedError,Migrate JUnit 4 assertion failure exceptions to JUnit Jupiter,Replace JUnit 4's `junit.framework.AssertionFailedError` and `org.junit.ComparisonFailure` with JUnit Jupiter's `org.opentest4j.AssertionFailedError`.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.VertxUnitToVertxJunit5,Use Vert.x JUnit 5 Extension,Migrates Vert.x `@RunWith` `VertxUnitRunner` to the JUnit Jupiter `@ExtendWith` `VertxExtension`.,7,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeOkHttpMockWebServer,Use OkHttp 3 MockWebServer for JUnit 5,Migrates OkHttp 3 `MockWebServer` to enable JUnit Jupiter Extension support.,67,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.CleanupAssertions,Clean Up Assertions,Simplifies JUnit Jupiter assertions to their most-direct equivalents.,25,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UseXMLUnitLegacy,Use XMLUnit Legacy for JUnit 5,Migrates XMLUnit 1.x to XMLUnit legacy 2.x.,5,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeSurefirePlugin,Upgrade Surefire Plugin,Upgrades the Maven Surefire Plugin to the latest version if still using an older Maven version.,7,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeToJUnit513,Upgrade to JUnit 5.13,Upgrades JUnit 5 to 5.13.x and migrates all deprecated APIs.,25,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit5.UpgradeToJUnit514,Upgrade to JUnit 5.14,Upgrades JUnit 5 to 5.14.x and migrates all deprecated APIs.,51,JUnit Jupiter,Testing,Java,Best practices for JUnit Jupiter tests.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit6.MigrateMethodOrdererAlphanumeric,Migrate `MethodOrderer.Alphanumeric` to `MethodOrderer.MethodName`,JUnit 6 removed the `MethodOrderer.Alphanumeric` class. This recipe migrates usages to `MethodOrderer.MethodName` which provides similar functionality.,1,Junit6,Testing,Java,,,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit6.MinimumJreConditions,Migrate JUnit JRE conditions,"This recipe will: - Remove tests that are only active on JREs that are below the specified version. - - Adjust ranges to use minimum the specified version.",1,Junit6,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""javaVersion"",""type"":""String"",""displayName"":""JRE version"",""description"":""The minimum JRE version to use for test conditions."",""example"":""17"",""required"":true}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit6.RemoveInterceptDynamicTest,Remove `InvocationInterceptor.interceptDynamicTest`,"JUnit 6 removed the `interceptDynamicTest(Invocation, ExtensionContext)` method from `InvocationInterceptor`. This recipe removes implementations of this deprecated method.",1,Junit6,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit6.JUnit5to6Migration,JUnit 6 migration from JUnit 5.x,Migrates JUnit 5.x tests to JUnit 6.x.,79,Junit6,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.AddMockitoExtensionIfAnnotationsUsed,Adds Mockito extensions to Mockito tests,Adds `@ExtendWith(MockitoExtension.class)` to tests using `@Mock` or `@Captor`.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.AnyStringToNullable,Replace Mockito 1.x `anyString()` with `nullable(String.class)`,Since Mockito 2.10 `anyString()` no longer matches null values. Use `nullable(Class)` instead.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.CleanupMockitoImports,Cleanup Mockito imports,"Removes unused `org.mockito` import symbols, unless its possible they are associated with method invocations having null or unknown type information.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.CleanupPowerMockImports,Cleanup PowerMock imports,Removes unused `org.powermock` import symbols.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.CloseUnclosedStaticMocks,Close unclosed static mocks,"Ensures that all `mockStatic` calls are properly closed. If `mockStatic` is in lifecycle methods like `@BeforeEach` or `@BeforeAll`, creates a class variable and closes it in `@AfterEach` or `@AfterAll`. If `mockStatic` is inside a test method, wraps it in a try-with-resources block.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockConstructionToTryWithResources,Wrap `MockedConstruction` in try-with-resources,"Wraps `MockedConstruction` variable declarations that have explicit `.close()` calls into try-with-resources blocks, removing the explicit close call. This ensures proper resource management and makes the code cleaner.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockUtilsToStatic,Use static form of Mockito `MockUtil`,Best-effort attempt to remove Mockito `MockUtil` instances.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoJUnitRunnerSilentToExtension,JUnit 4 MockitoJUnitRunner.Silent to JUnit Jupiter MockitoExtension with LENIENT settings,Replace `@RunWith(MockitoJUnitRunner.Silent.class)` with `@ExtendWith(MockitoExtension.class)` and `@MockitoSettings(strictness = Strictness.LENIENT)`.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoJUnitRunnerToExtension,Replace JUnit 4 MockitoJUnitRunner with junit-jupiter MockitoExtension,"Replace JUnit 4 MockitoJUnitRunner annotations with JUnit 5 `@ExtendWith(MockitoExtension.class)` using the appropriate strictness levels (LENIENT, WARN, STRICT_STUBS).",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoWhenOnStaticToMockStatic,Replace `Mockito.when` on static (non mock) with try-with-resource with MockedStatic,"Replace `Mockito.when` on static (non mock) with try-with-resource with MockedStatic as Mockito4 no longer allows this. For JUnit 4/5 & TestNG: When `@Before*` is used, a `close` call is added to the corresponding `@After*` method. This change moves away from implicit bytecode manipulation for static method stubbing, making mocking behavior more explicit and scoped to avoid unintended side effects.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.PowerMockitoMockStaticToMockito,Replace `PowerMock.mockStatic()` with `Mockito.mockStatic()`,Replaces `PowerMockito.mockStatic()` by `Mockito.mockStatic()`. Removes the `@PrepareForTest` annotation.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.PowerMockitoWhenNewToMockito,Replace `PowerMockito.whenNew` with Mockito counterpart,Replaces `PowerMockito.whenNew` calls with respective `Mockito.whenConstructed` calls.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.RemoveInitMocksIfRunnersSpecified,Remove `MockitoAnnotations.initMocks(this)` if specified JUnit runners,Remove `MockitoAnnotations.initMocks(this)` if specified class-level JUnit runners `@RunWith(MockitoJUnitRunner.class)` or `@ExtendWith(MockitoExtension.class)`.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.RemoveTimesZeroAndOne,Remove `Mockito.times(0)` and `Mockito.times(1)`,Remove `Mockito.times(0)` and `Mockito.times(1)` from `Mockito.verify()` calls.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.ReplaceInitMockToOpenMock,Replace `MockitoAnnotations.initMocks(this)` to `MockitoAnnotations.openMocks(this)`,Replace `MockitoAnnotations.initMocks(this)` to `MockitoAnnotations.openMocks(this)` and generate `AutoCloseable` mocks.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.SimplifyMockitoVerifyWhenGiven,"Call to Mockito method ""verify"", ""when"" or ""given"" should be simplified","Fixes Sonar issue `java:S6068`: Call to Mockito method ""verify"", ""when"" or ""given"" should be simplified.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.AnyToNullable,Replace Mockito 1.x `anyString()`/`any()` with `nullable(Class)`,Since Mockito 2.10 `anyString()` and `any()` no longer matches null values. Use `nullable(Class)` instead.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.VerifyZeroToNoMoreInteractions,Replace `verifyZeroInteractions()` with `verifyNoMoreInteractions()`,Replaces `verifyZeroInteractions()` with `verifyNoMoreInteractions()` in Mockito tests when migration when using a Mockito version < 3.x.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoBestPractices,Mockito best practices,Applies best practices for Mockito tests.,225,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito1to5Migration,Mockito 5.x upgrade,Upgrade Mockito from 1.x to 5.x.,215,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito4to5Only,Mockito 4 to 5.x upgrade only,Upgrade Mockito from 4.x to 5.x. Does not include 1.x to 4.x migration.,111,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito1to4Migration,Mockito 4.x upgrade,Upgrade Mockito from 1.x to 4.x.,101,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito1to3Migration,Mockito 3.x migration from 1.x,Upgrade Mockito from 1.x to 3.x.,91,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.ReplacePowerMockito,Replace PowerMock with raw Mockito,PowerMockito with raw Mockito; best executed as part of a Mockito upgrade.,23,Mockito,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.AddTestcontainersAnnotations,Adopt `@Container` and add `@Testcontainers`,Convert Testcontainers `@Rule`/`@ClassRule` to JUnit 5 `@Container` and add `@Testcontainers`.,1,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.ConvertToRawType,Remove parameterized type arguments from a Java class,Convert parameterized types of a specified Java class to their raw types.,1,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,"[{""name"":""fullyQualifiedTypeName"",""type"":""String"",""displayName"":""Fully qualified type name"",""description"":""The fully qualified name of the Java class to convert to its raw type."",""example"":""org.testcontainers.containers.PostgreSQLContainer"",""required"":true}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.ExplicitContainerImage,Add image argument to container constructor,"Set the image to use for a container explicitly if unset, rather than relying on the default image for the container class.",1,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,"[{""name"":""containerClass"",""type"":""String"",""displayName"":""Container class"",""description"":""The fully qualified name of the container class to use."",""example"":""org.testcontainers.containers.NginxContainer"",""required"":true},{""name"":""image"",""type"":""String"",""displayName"":""Image to use"",""description"":""The image to use for the container."",""example"":""nginx:1.9.4"",""required"":true},{""name"":""parseImage"",""type"":""Boolean"",""displayName"":""Parse image"",""description"":""Whether to call `DockerImageName.parse(image)`.""}]" -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.TestContainersBestPractices,Testcontainers best practices,Apply best practices to Testcontainers usage.,297,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.Testcontainers2Migration,Migrate to testcontainers-java 2.x,Change dependencies and types to migrate to testcontainers-java 2.x.,295,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.GetHostMigration,Replace `ContainerState.getContainerIpAddress()` with `getHost()`,Replace `org.testcontainers.containers.ContainerState.getContainerIpAddress()` with `getHost()`.,3,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.ExplicitContainerImages,Explicit container images and versions,Replace implicit default container images and versions with explicit versions.,51,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.Testcontainers2Dependencies,Rename Testcontainers dependencies,Change Testcontainers dependencies to adopt the new consistent `testcontainers-` prefix.,125,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.Testcontainers2ContainerClasses,Testcontainers 2 container classes,Change Testcontainers container classes to their new package locations in Testcontainers 2.x.,107,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testng.TestNgAssertEqualsToAssertThat,TestNG `assertEquals` to AssertJ,Convert TestNG-style `assertEquals()` to AssertJ's `assertThat().isEqualTo()`.,1,TestNG,Testing,Java,Recipes for migrating from [TestNG](https://testng.org/) to JUnit.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testng.TestNgAssertNotEqualsToAssertThat,TestNG `assertNotEquals` to AssertJ,Convert TestNG-style `assertNotEquals()` to AssertJ's `assertThat().isNotEqualTo()`.,1,TestNG,Testing,Java,Recipes for migrating from [TestNG](https://testng.org/) to JUnit.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testng.TestNgToAssertj,Migrate TestNG assertions to AssertJ,Convert assertions from `org.testng.Assert` to `org.assertj.core.api.Assertions`.,95,TestNG,Testing,Java,Recipes for migrating from [TestNG](https://testng.org/) to JUnit.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthAssertToAssertThat,Convert Truth `assert_()` to AssertJ,Converts Google Truth's `assert_()` method to AssertJ's standard assertion pattern.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthAssertWithMessageToAssertJ,Convert Truth `assertWithMessage` to AssertJ,Converts Google Truth's `assertWithMessage().that()` pattern to AssertJ's `assertThat().as()` pattern.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthCustomSubjectsToAssertJ,Migrate Truth custom subjects to AssertJ,Marks Google Truth's `assertAbout()` usage for manual review as AssertJ handles custom assertions differently.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthThrowableAssertions,Convert Truth Throwable assertions to AssertJ,Converts Google Truth's Throwable assertion chains like `hasMessageThat().contains()` to AssertJ equivalents.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.MigrateTruthToAssertJ,Migrate Google Truth to AssertJ,Migrate Google Truth assertions to AssertJ assertions.,111,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.archunit.ArchUnit0to1Migration,ArchUnit 0.x upgrade,Upgrade ArchUnit from 0.x to 1.x.,19,ArchUnit,Testing,Java,Recipes for [ArchUnit](https://www.archunit.org/) architecture testing.,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.byteman.BytemanJUnit4ToBytemanJUnit5,Use Byteman JUnit 5 dependency,Migrates Byteman JUnit 4 to JUnit 5.,5,Byteman,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.datafaker.JavaFakerToDataFaker,Migrate from Java Faker to Datafaker,Change imports and dependencies related to Java Faker to Datafaker replacements.,11,DataFaker,Testing,Java,Recipes for migrating from JavaFaker to [DataFaker](https://www.datafaker.net/).,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit.JupiterBestPractices,JUnit Jupiter best practices,Applies best practices to tests.,85,Junit,Testing,Java,,,Basic building blocks for transforming Java code., -maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit.JUnit6BestPractices,JUnit 6 best practices,Applies best practices to tests.,167,Junit,Testing,Java,,,Basic building blocks for transforming Java code., + - Adjust ranges to use minimum the specified version.",1,Junit6,Testing,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""javaVersion"",""type"":""String"",""displayName"":""JRE version"",""description"":""The minimum JRE version to use for test conditions."",""example"":""17"",""required"":true}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit6.RemoveInterceptDynamicTest,Remove `InvocationInterceptor.interceptDynamicTest`,"JUnit 6 removed the `interceptDynamicTest(Invocation, ExtensionContext)` method from `InvocationInterceptor`. This recipe removes implementations of this deprecated method.",1,Junit6,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit6.JUnit5to6Migration,JUnit 6 migration from JUnit 5.x,Migrates JUnit 5.x tests to JUnit 6.x.,83,Junit6,Testing,Java,,,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.AddMockitoExtensionIfAnnotationsUsed,Adds Mockito extensions to Mockito tests,Adds `@ExtendWith(MockitoExtension.class)` to tests using `@Mock` or `@Captor`.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.AnyStringToNullable,Replace Mockito 1.x `anyString()` with `nullable(String.class)`,Since Mockito 2.10 `anyString()` no longer matches null values. Use `nullable(Class)` instead.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.CleanupMockitoImports,Cleanup Mockito imports,"Removes unused `org.mockito` import symbols, unless its possible they are associated with method invocations having null or unknown type information.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.CleanupPowerMockImports,Cleanup PowerMock imports,Removes unused `org.powermock` import symbols.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.CloseUnclosedStaticMocks,Close unclosed static mocks,"Ensures that all `mockStatic` calls are properly closed. If `mockStatic` is in lifecycle methods like `@BeforeEach` or `@BeforeAll`, creates a class variable and closes it in `@AfterEach` or `@AfterAll`. If `mockStatic` is inside a test method, wraps it in a try-with-resources block.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockConstructionToTryWithResources,Wrap `MockedConstruction` in try-with-resources,"Wraps `MockedConstruction` variable declarations that have explicit `.close()` calls into try-with-resources blocks, removing the explicit close call. This ensures proper resource management and makes the code cleaner.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockUtilsToStatic,Use static form of Mockito `MockUtil`,Best-effort attempt to remove Mockito `MockUtil` instances.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoJUnitRunnerSilentToExtension,JUnit 4 MockitoJUnitRunner.Silent to JUnit Jupiter MockitoExtension with LENIENT settings,Replace `@RunWith(MockitoJUnitRunner.Silent.class)` with `@ExtendWith(MockitoExtension.class)` and `@MockitoSettings(strictness = Strictness.LENIENT)`.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoJUnitRunnerToExtension,Replace JUnit 4 MockitoJUnitRunner with junit-jupiter MockitoExtension,"Replace JUnit 4 MockitoJUnitRunner annotations with JUnit 5 `@ExtendWith(MockitoExtension.class)` using the appropriate strictness levels (LENIENT, WARN, STRICT_STUBS).",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoWhenOnStaticToMockStatic,Replace `Mockito.when` on static (non mock) with try-with-resource with MockedStatic,"Replace `Mockito.when` on static (non mock) with try-with-resource with MockedStatic as Mockito4 no longer allows this. For JUnit 4/5 & TestNG: When `@Before*` is used, a `close` call is added to the corresponding `@After*` method. This change moves away from implicit bytecode manipulation for static method stubbing, making mocking behavior more explicit and scoped to avoid unintended side effects.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.PowerMockitoMockStaticToMockito,Replace `PowerMock.mockStatic()` with `Mockito.mockStatic()`,Replaces `PowerMockito.mockStatic()` by `Mockito.mockStatic()`. Removes the `@PrepareForTest` annotation.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.PowerMockitoWhenNewToMockito,Replace `PowerMockito.whenNew` with Mockito counterpart,Replaces `PowerMockito.whenNew` calls with respective `Mockito.whenConstructed` calls.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.RemoveInitMocksIfRunnersSpecified,Remove `MockitoAnnotations.initMocks(this)` and `openMocks(this)` if JUnit runners specified,Remove `MockitoAnnotations.initMocks(this)` and `MockitoAnnotations.openMocks(this)` if class-level JUnit runners `@RunWith(MockitoJUnitRunner.class)` or `@ExtendWith(MockitoExtension.class)` are specified. These manual initialization calls are redundant when using Mockito's JUnit integration.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.RemoveTimesZeroAndOne,Remove `Mockito.times(0)` and `Mockito.times(1)`,Remove `Mockito.times(0)` and `Mockito.times(1)` from `Mockito.verify()` calls.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.ReplaceInitMockToOpenMock,Replace `MockitoAnnotations.initMocks(this)` to `MockitoAnnotations.openMocks(this)`,Replace `MockitoAnnotations.initMocks(this)` to `MockitoAnnotations.openMocks(this)` and generate `AutoCloseable` mocks.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.SimplifyMockitoVerifyWhenGiven,"Call to Mockito method ""verify"", ""when"" or ""given"" should be simplified","Fixes Sonar issue `java:S6068`: Call to Mockito method ""verify"", ""when"" or ""given"" should be simplified.",1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.AnyToNullable,Replace Mockito 1.x `anyString()`/`any()` with `nullable(Class)`,Since Mockito 2.10 `anyString()` and `any()` no longer matches null values. Use `nullable(Class)` instead.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.VerifyZeroToNoMoreInteractions,Replace `verifyZeroInteractions()` with `verifyNoMoreInteractions()`,Replaces `verifyZeroInteractions()` with `verifyNoMoreInteractions()` in Mockito tests when migration when using a Mockito version < 3.x.,1,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.MockitoBestPractices,Mockito best practices,Applies best practices for Mockito tests.,243,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito1to5Migration,Mockito 5.x upgrade,Upgrade Mockito from 1.x to 5.x.,231,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito4to5Only,Mockito 4 to 5.x upgrade only,Upgrade Mockito from 4.x to 5.x. Does not include 1.x to 4.x migration.,119,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito1to4Migration,Mockito 4.x upgrade,Upgrade Mockito from 1.x to 4.x.,107,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.Mockito1to3Migration,Mockito 3.x migration from 1.x,Upgrade Mockito from 1.x to 3.x.,95,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.mockito.ReplacePowerMockito,Replace PowerMock with raw Mockito,PowerMockito with raw Mockito; best executed as part of a Mockito upgrade.,25,Mockito,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.AddTestcontainersAnnotations,Adopt `@Container` and add `@Testcontainers`,Convert Testcontainers `@Rule`/`@ClassRule` to JUnit 5 `@Container` and add `@Testcontainers`.,1,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.ConvertToRawType,Remove parameterized type arguments from a Java class,Convert parameterized types of a specified Java class to their raw types.,1,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,"[{""name"":""fullyQualifiedTypeName"",""type"":""String"",""displayName"":""Fully qualified type name"",""description"":""The fully qualified name of the Java class to convert to its raw type."",""example"":""org.testcontainers.containers.PostgreSQLContainer"",""required"":true}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.ExplicitContainerImage,Add image argument to container constructor,"Set the image to use for a container explicitly if unset, rather than relying on the default image for the container class.",1,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,"[{""name"":""containerClass"",""type"":""String"",""displayName"":""Container class"",""description"":""The fully qualified name of the container class to use."",""example"":""org.testcontainers.containers.NginxContainer"",""required"":true},{""name"":""image"",""type"":""String"",""displayName"":""Image to use"",""description"":""The image to use for the container."",""example"":""nginx:1.9.4"",""required"":true},{""name"":""parseImage"",""type"":""Boolean"",""displayName"":""Parse image"",""description"":""Whether to call `DockerImageName.parse(image)`.""}]", +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.TestContainersBestPractices,Testcontainers best practices,Apply best practices to Testcontainers usage.,309,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.Testcontainers2Migration,Migrate to testcontainers-java 2.x,Change dependencies and types to migrate to testcontainers-java 2.x.,305,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.GetHostMigration,Replace `ContainerState.getContainerIpAddress()` with `getHost()`,Replace `org.testcontainers.containers.ContainerState.getContainerIpAddress()` with `getHost()`.,5,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.ExplicitContainerImages,Explicit container images and versions,Replace implicit default container images and versions with explicit versions.,53,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.Testcontainers2Dependencies,Rename Testcontainers dependencies,Change Testcontainers dependencies to adopt the new consistent `testcontainers-` prefix.,127,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testcontainers.Testcontainers2ContainerClasses,Testcontainers 2 container classes,Change Testcontainers container classes to their new package locations in Testcontainers 2.x.,109,Testcontainers,Testing,Java,Recipes for [Testcontainers](https://testcontainers.com/) integration testing with Docker.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testng.TestNgAssertEqualsToAssertThat,TestNG `assertEquals` to AssertJ,Convert TestNG-style `assertEquals()` to AssertJ's `assertThat().isEqualTo()`.,1,TestNG,Testing,Java,Recipes for migrating from [TestNG](https://testng.org/) to JUnit.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testng.TestNgAssertNotEqualsToAssertThat,TestNG `assertNotEquals` to AssertJ,Convert TestNG-style `assertNotEquals()` to AssertJ's `assertThat().isNotEqualTo()`.,1,TestNG,Testing,Java,Recipes for migrating from [TestNG](https://testng.org/) to JUnit.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.testng.TestNgToAssertj,Migrate TestNG assertions to AssertJ,Convert assertions from `org.testng.Assert` to `org.assertj.core.api.Assertions`.,97,TestNG,Testing,Java,Recipes for migrating from [TestNG](https://testng.org/) to JUnit.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthAssertToAssertThat,Convert Truth `assert_()` to AssertJ,Converts Google Truth's `assert_()` method to AssertJ's standard assertion pattern.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthAssertWithMessageToAssertJ,Convert Truth `assertWithMessage` to AssertJ,Converts Google Truth's `assertWithMessage().that()` pattern to AssertJ's `assertThat().as()` pattern.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthCustomSubjectsToAssertJ,Migrate Truth custom subjects to AssertJ,Marks Google Truth's `assertAbout()` usage for manual review as AssertJ handles custom assertions differently.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.TruthThrowableAssertions,Convert Truth Throwable assertions to AssertJ,Converts Google Truth's Throwable assertion chains like `hasMessageThat().contains()` to AssertJ equivalents.,1,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.truth.MigrateTruthToAssertJ,Migrate Google Truth to AssertJ,Migrate Google Truth assertions to AssertJ assertions.,113,Google Truth,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.archunit.ArchUnit0to1Migration,ArchUnit 0.x upgrade,Upgrade ArchUnit from 0.x to 1.x.,21,ArchUnit,Testing,Java,Recipes for [ArchUnit](https://www.archunit.org/) architecture testing.,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.byteman.BytemanJUnit4ToBytemanJUnit5,Use Byteman JUnit 5 dependency,Migrates Byteman JUnit 4 to JUnit 5.,7,Byteman,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.datafaker.JavaFakerToDataFaker,Migrate from Java Faker to Datafaker,Change imports and dependencies related to Java Faker to Datafaker replacements.,13,DataFaker,Testing,Java,Recipes for migrating from JavaFaker to [DataFaker](https://www.datafaker.net/).,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit.JupiterBestPractices,JUnit Jupiter best practices,Applies best practices to tests.,95,Junit,Testing,Java,,,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.junit.JUnit6BestPractices,JUnit 6 best practices,Applies best practices to tests.,183,Junit,Testing,Java,,,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" diff --git a/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestEveryItemToAssertJTest.java b/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestEveryItemToAssertJTest.java new file mode 100644 index 000000000..f47f6dc0e --- /dev/null +++ b/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestEveryItemToAssertJTest.java @@ -0,0 +1,158 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://docs.moderne.io/licensing/moderne-source-available-license + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openrewrite.java.testing.hamcrest; + +import org.junit.jupiter.api.Test; +import org.openrewrite.DocumentExample; +import org.openrewrite.InMemoryExecutionContext; +import org.openrewrite.Issue; +import org.openrewrite.java.JavaParser; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.RewriteTest; + +import static org.openrewrite.java.Assertions.java; + +@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/915") +class HamcrestEveryItemToAssertJTest implements RewriteTest { + @Override + public void defaults(RecipeSpec spec) { + spec + .parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), + "junit-jupiter-api-5", + "hamcrest-3", + "assertj-core-3")) + .recipe(new HamcrestEveryItemToAssertJ()); + } + + @DocumentExample + @Test + void everyItemInstanceOf() { + //language=java + rewriteRun( + java( + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.everyItem; + import static org.hamcrest.Matchers.instanceOf; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", "b"); + assertThat(list, everyItem(instanceOf(String.class))); + } + } + """, + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", "b"); + assertThat(list).hasOnlyElementsOfType(String.class); + } + } + """ + ) + ); + } + + @Test + void everyItemGeneralMatcher() { + //language=java + rewriteRun( + java( + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.everyItem; + import static org.hamcrest.Matchers.greaterThan; + + class MyTest { + @Test + void testMethod() { + List list = List.of(5, 6, 7); + assertThat(list, everyItem(greaterThan(4))); + } + } + """, + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.greaterThan; + + class MyTest { + @Test + void testMethod() { + List list = List.of(5, 6, 7); + org.assertj.core.api.Assertions.assertThat(list).allSatisfy(arg -> assertThat(arg, greaterThan(4))); + } + } + """ + ) + ); + } + + @Test + void everyItemInstanceOfWithReason() { + //language=java + rewriteRun( + java( + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.everyItem; + import static org.hamcrest.Matchers.instanceOf; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", "b"); + assertThat("all should be strings", list, everyItem(instanceOf(String.class))); + } + } + """, + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", "b"); + assertThat(list).as("all should be strings").hasOnlyElementsOfType(String.class); + } + } + """ + ) + ); + } +} diff --git a/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestHasItemMatcherToAssertJTest.java b/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestHasItemMatcherToAssertJTest.java new file mode 100644 index 000000000..f00c72180 --- /dev/null +++ b/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestHasItemMatcherToAssertJTest.java @@ -0,0 +1,158 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://docs.moderne.io/licensing/moderne-source-available-license + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openrewrite.java.testing.hamcrest; + +import org.junit.jupiter.api.Test; +import org.openrewrite.DocumentExample; +import org.openrewrite.InMemoryExecutionContext; +import org.openrewrite.Issue; +import org.openrewrite.java.JavaParser; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.RewriteTest; + +import static org.openrewrite.java.Assertions.java; + +@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/915") +class HamcrestHasItemMatcherToAssertJTest implements RewriteTest { + @Override + public void defaults(RecipeSpec spec) { + spec + .parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), + "junit-jupiter-api-5", + "hamcrest-3", + "assertj-core-3")) + .recipe(new HamcrestHasItemMatcherToAssertJ()); + } + + @DocumentExample + @Test + void hasItemInstanceOf() { + //language=java + rewriteRun( + java( + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.hasItem; + import static org.hamcrest.Matchers.instanceOf; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", 1, 2.0); + assertThat(list, hasItem(instanceOf(String.class))); + } + } + """, + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", 1, 2.0); + assertThat(list).hasAtLeastOneElementOfType(String.class); + } + } + """ + ) + ); + } + + @Test + void hasItemGeneralMatcher() { + //language=java + rewriteRun( + java( + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.greaterThan; + import static org.hamcrest.Matchers.hasItem; + + class MyTest { + @Test + void testMethod() { + List list = List.of(1, 2, 3); + assertThat(list, hasItem(greaterThan(2))); + } + } + """, + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.greaterThan; + + class MyTest { + @Test + void testMethod() { + List list = List.of(1, 2, 3); + org.assertj.core.api.Assertions.assertThat(list).anySatisfy(arg -> assertThat(arg, greaterThan(2))); + } + } + """ + ) + ); + } + + @Test + void hasItemInstanceOfWithReason() { + //language=java + rewriteRun( + java( + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.hasItem; + import static org.hamcrest.Matchers.instanceOf; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", 1, 2.0); + assertThat("should contain a string", list, hasItem(instanceOf(String.class))); + } + } + """, + """ + import java.util.List; + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + List list = List.of("a", 1, 2.0); + assertThat(list).as("should contain a string").hasAtLeastOneElementOfType(String.class); + } + } + """ + ) + ); + } +} diff --git a/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestHasPropertyToAssertJTest.java b/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestHasPropertyToAssertJTest.java new file mode 100644 index 000000000..ef4995b7e --- /dev/null +++ b/src/test/java/org/openrewrite/java/testing/hamcrest/HamcrestHasPropertyToAssertJTest.java @@ -0,0 +1,210 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://docs.moderne.io/licensing/moderne-source-available-license + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openrewrite.java.testing.hamcrest; + +import org.junit.jupiter.api.Test; +import org.openrewrite.DocumentExample; +import org.openrewrite.InMemoryExecutionContext; +import org.openrewrite.Issue; +import org.openrewrite.java.JavaParser; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.RewriteTest; + +import static org.openrewrite.java.Assertions.java; + +@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/915") +class HamcrestHasPropertyToAssertJTest implements RewriteTest { + @Override + public void defaults(RecipeSpec spec) { + spec + .parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), + "junit-jupiter-api-5", + "hamcrest-3", + "assertj-core-3")) + .recipe(new HamcrestHasPropertyToAssertJ()); + } + + @DocumentExample + @Test + void hasPropertyName() { + //language=java + rewriteRun( + java( + """ + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.hasProperty; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj, hasProperty("class")); + } + } + """, + """ + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj).hasFieldOrProperty("class"); + } + } + """ + ) + ); + } + + @Test + void hasPropertyWithEqualTo() { + //language=java + rewriteRun( + java( + """ + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.equalTo; + import static org.hamcrest.Matchers.hasProperty; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj, hasProperty("class", equalTo(Object.class))); + } + } + """, + """ + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj).hasFieldOrPropertyWithValue("class", Object.class); + } + } + """ + ) + ); + } + + @Test + void hasPropertyWithIs() { + //language=java + rewriteRun( + java( + """ + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.hasProperty; + import static org.hamcrest.Matchers.is; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj, hasProperty("class", is(Object.class))); + } + } + """, + """ + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj).hasFieldOrPropertyWithValue("class", Object.class); + } + } + """ + ) + ); + } + + @Test + void hasPropertyWithReason() { + //language=java + rewriteRun( + java( + """ + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.hasProperty; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat("should have class property", obj, hasProperty("class")); + } + } + """, + """ + import org.junit.jupiter.api.Test; + + import static org.assertj.core.api.Assertions.assertThat; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj).as("should have class property").hasFieldOrProperty("class"); + } + } + """ + ) + ); + } + + @Test + void doesNotConvertUnknownMatcher() { + //language=java + rewriteRun( + java( + """ + import org.junit.jupiter.api.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.greaterThan; + import static org.hamcrest.Matchers.hasProperty; + + class MyTest { + @Test + void testMethod() { + Object obj = new Object(); + assertThat(obj, hasProperty("size", greaterThan(5))); + } + } + """ + ) + ); + } +}