TestsShouldNotBePublic should also remove public modifier from classes containing methods meta-annotated with @Test and other such annotations. Seen on openrewrite/rewrite-maven-plugin#498, where the initial commit did not pick up on the @MavenTest annotations in our tests, which are themselves annotated with @Test.
@MavenJupiterExtension
@MavenOption(MavenCLIOptions.NO_TRANSFER_PROGRESS)
@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:discover")
-public class DiscoverNoActiveRecipeIT {
+class DiscoverNoActiveRecipeIT {
@MavenTest // <!-- because `@MavenTest` is annoted with `@Test`
void single_project(MavenExecutionResult result) {
assertThat(result)
.isSuccessful()
.out()
.error()
.noneSatisfy(line -> assertThat(line).contains("Could not find recipe 'null' among available recipes"));
}
}
TestsShouldNotBePublic should also remove public modifier from classes containing methods meta-annotated with
@Testand other such annotations. Seen on openrewrite/rewrite-maven-plugin#498, where the initial commit did not pick up on the@MavenTestannotations in our tests, which are themselves annotated with@Test.@MavenJupiterExtension @MavenOption(MavenCLIOptions.NO_TRANSFER_PROGRESS) @MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:discover") -public class DiscoverNoActiveRecipeIT { +class DiscoverNoActiveRecipeIT { @MavenTest // <!-- because `@MavenTest` is annoted with `@Test` void single_project(MavenExecutionResult result) { assertThat(result) .isSuccessful() .out() .error() .noneSatisfy(line -> assertThat(line).contains("Could not find recipe 'null' among available recipes")); } }