Recipe testing best practices
MSALBest practices for testing recipes.
org. openrewrite. java. recipes. RecipeTestingBestPracticesmod run . --recipe= org. openrewrite. java. recipes. RecipeTestingBestPracticesInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Replace
Stream.collect(Collectors.toUnmodifiableList())withStream.toList() - One classpath argument per line
- RewriteTest classes should not be public
- Automatically select recipe examples from the unit test cases of a recipe
- Single
@DocumentExampleper test class - Show
@DocumentExamples first - Replace null with RewriteTest.doesNotExist()
- New line at the end of
SourceSpecstext blocks - Minimal indentation for
SourceSpecstext blocks - Refactor RewriteTest to use defaults method
- Remove
RecipeSpec.cycles(int)calls that restate the default - Find method calls and say what to do instead
- Find method calls and say what to do instead
- Find method calls and say what to do instead
- Use
StringUtilsutility methods - Use
varfor variables initialized with type casts - Use
varfor constructor call assignments - Apply
varto generic constructors - Apply
varto generic method invocations - Use
varfor primitive and String variables - Use modernized
java.utilAPIs - Convert Javadoc to Markdown documentation comments
- JUnit 6 best practices
- AssertJ best practices
- Fix missing braces
- Remove
System.out#printlnandSystem.err#printlnstatements - Reorder annotations alphabetically
- Use static import
org.openrewrite..Assertions *(..) - Use static import
org.openrewrite.test.RewriteTest *(..) - Use static import
org.openrewrite.test.SourceSpecs *(..) - Change method target to static
- Change method name
java.util.List asList(..)toof