diff --git a/testng-junit-migrator/pom.xml b/testng-junit-migrator/pom.xml index be5d1782b5e..5399dc36611 100644 --- a/testng-junit-migrator/pom.xml +++ b/testng-junit-migrator/pom.xml @@ -12,6 +12,7 @@ Picnic :: Error Prone Support :: TestNG JUnit Migrator A tool to migrate TestNG tests to JUnit + https://error-prone.picnic.tech diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/AttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/AttributeMigrator.java index c840813aac9..6e9bfa4e138 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/AttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/AttributeMigrator.java @@ -5,7 +5,7 @@ import com.google.errorprone.fixes.SuggestedFix; import com.sun.source.tree.MethodTree; import java.util.Optional; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; /** * Interface implemented by classes that define how to migrate a specific attribute from a TestNG @@ -22,7 +22,7 @@ interface AttributeMigrator { * Optional#empty()} if the {@link AttributeMigrator} is not able to migrate the attribute. */ Optional migrate( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, MethodTree methodTree, VisitorState state); diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DataProviderAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DataProviderAttributeMigrator.java index 01a047422ca..1a07831d675 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DataProviderAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DataProviderAttributeMigrator.java @@ -7,7 +7,7 @@ import com.sun.source.tree.ExpressionTree; import com.sun.source.tree.MethodTree; import java.util.Optional; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; /** * A {@link AttributeMigrator} that migrates the {@code org.testng.annotations.Test#dataProvider} @@ -17,7 +17,7 @@ final class DataProviderAttributeMigrator implements AttributeMigrator { @Override public Optional migrate( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, MethodTree methodTree, VisitorState state) { diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DescriptionAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DescriptionAttributeMigrator.java index a3a7cfc29dd..c5627f77e53 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DescriptionAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/DescriptionAttributeMigrator.java @@ -5,7 +5,7 @@ import com.google.errorprone.fixes.SuggestedFix; import com.sun.source.tree.MethodTree; import java.util.Optional; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; import tech.picnic.errorprone.util.SourceCode; /** A {@link AttributeMigrator} that migrates the {@code description} attribute. */ @@ -13,7 +13,7 @@ final class DescriptionAttributeMigrator implements AttributeMigrator { @Override public Optional migrate( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, MethodTree methodTree, VisitorState state) { diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/EnabledAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/EnabledAttributeMigrator.java index be8d9f43390..0508306ec1e 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/EnabledAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/EnabledAttributeMigrator.java @@ -6,14 +6,14 @@ import com.sun.source.tree.LiteralTree; import com.sun.source.tree.MethodTree; import java.util.Optional; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; /** A {@link AttributeMigrator} that migrates the {@code enabled} attribute. */ @Immutable final class EnabledAttributeMigrator implements AttributeMigrator { @Override public Optional migrate( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, MethodTree methodTree, VisitorState state) { diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/ExpectedExceptionsAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/ExpectedExceptionsAttributeMigrator.java index 7acfc894fd1..31f3c218d36 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/ExpectedExceptionsAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/ExpectedExceptionsAttributeMigrator.java @@ -13,7 +13,7 @@ import com.sun.source.tree.MethodTree; import com.sun.source.tree.NewArrayTree; import java.util.Optional; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; import tech.picnic.errorprone.util.SourceCode; /** A {@link AttributeMigrator} that migrates the {@code expectedExceptions} attribute. */ @@ -21,7 +21,7 @@ final class ExpectedExceptionsAttributeMigrator implements AttributeMigrator { @Override public Optional migrate( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, MethodTree methodTree, VisitorState state) { diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/GroupsAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/GroupsAttributeMigrator.java index 2cc72898f30..5014b939446 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/GroupsAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/GroupsAttributeMigrator.java @@ -11,7 +11,7 @@ import com.sun.source.tree.NewArrayTree; import com.sun.source.tree.Tree; import java.util.Optional; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; import tech.picnic.errorprone.util.SourceCode; /** A {@link AttributeMigrator} that migrates the {@code group} attribute. */ @@ -19,7 +19,7 @@ final class GroupsAttributeMigrator implements AttributeMigrator { @Override public Optional migrate( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, MethodTree methodTree, VisitorState state) { diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/PriorityAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/PriorityAttributeMigrator.java index 3fdd21a2009..a585c75dd46 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/PriorityAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/PriorityAttributeMigrator.java @@ -5,7 +5,7 @@ import com.google.errorprone.fixes.SuggestedFix; import com.sun.source.tree.MethodTree; import java.util.Optional; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; import tech.picnic.errorprone.util.SourceCode; /** @@ -16,7 +16,7 @@ final class PriorityAttributeMigrator implements AttributeMigrator { @Override public Optional migrate( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, MethodTree methodTree, VisitorState state) { diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/SetupTeardownMethodMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/SetupTeardownMethodMigrator.java index 16261bf811a..157e2ce3ddd 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/SetupTeardownMethodMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/SetupTeardownMethodMigrator.java @@ -8,7 +8,7 @@ import com.sun.source.tree.MethodTree; import java.util.Optional; import javax.lang.model.element.Modifier; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.SetupTeardownType; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.SetupTeardownType; /** * A helper class that migrates TestNG setup and teardown methods to their JUnit Jupiter equivalent. diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGJUnitMigration.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGJUnitMigration.java index 0270d0b8d3a..b271bd1f72c 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGJUnitMigration.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGJUnitMigration.java @@ -23,9 +23,9 @@ import java.util.Optional; import javax.inject.Inject; import org.jspecify.annotations.Nullable; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.DataProviderMetadata; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.SetupTeardownType; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.DataProviderMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.SetupTeardownType; /** * A {@link BugChecker} that migrates TestNG unit tests to JUnit 5. @@ -80,14 +80,14 @@ public TestNGJUnitMigration() { @Override public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState state) { TestNGScanner scanner = new TestNGScanner(state); - ImmutableMap classMetaData = scanner.collectMetadataForClasses(tree); + ImmutableMap classMetaData = scanner.collectMetadataForClasses(tree); - new TreeScanner<@Nullable Void, TestNGMetadata>() { + new TreeScanner<@Nullable Void, TestNgMetadata>() { @Override - public @Nullable Void visitClass(ClassTree node, TestNGMetadata testNGMetadata) { - TestNGMetadata metadata = classMetaData.get(node); + public @Nullable Void visitClass(ClassTree node, TestNgMetadata testNgMetadata) { + TestNgMetadata metadata = classMetaData.get(node); if (metadata == null) { - return super.visitClass(node, testNGMetadata); + return super.visitClass(node, testNgMetadata); } for (DataProviderMetadata dataProviderMetadata : metadata.getDataProvidersInUse()) { @@ -108,7 +108,7 @@ public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState s } @Override - public @Nullable Void visitMethod(MethodTree tree, TestNGMetadata metadata) { + public @Nullable Void visitMethod(MethodTree tree, TestNgMetadata metadata) { /* Make sure ALL Tests in the class can be migrated. */ if (conservativeMode && !canMigrateAllTestsInClass(metadata, state)) { return super.visitMethod(tree, metadata); @@ -133,7 +133,7 @@ public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState s } private static ImmutableList buildAttributeFixes( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotationMetadata, MethodTree methodTree, VisitorState state) { @@ -147,7 +147,7 @@ private static ImmutableList buildAttributeFixes( private static boolean canMigrateTest( MethodTree methodTree, - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotationMetadata, VisitorState state) { ImmutableList attributes = @@ -164,13 +164,13 @@ private static boolean canMigrateTest( .isPresent()); } - private static boolean canMigrateAllTestsInClass(TestNGMetadata metadata, VisitorState state) { + private static boolean canMigrateAllTestsInClass(TestNgMetadata metadata, VisitorState state) { return metadata.getMethodAnnotations().entrySet().stream() .allMatch(entry -> canMigrateTest(entry.getKey(), metadata, entry.getValue(), state)); } private static Optional trySuggestFix( - TestNGMetadata metadata, + TestNgMetadata metadata, AnnotationMetadata annotation, String attributeName, MethodTree methodTree, diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGScanner.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGScanner.java index d3532eecfd5..77ab9176eff 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGScanner.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGScanner.java @@ -24,9 +24,9 @@ import java.util.Optional; import javax.lang.model.element.Modifier; import org.jspecify.annotations.Nullable; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.DataProviderMetadata; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.SetupTeardownType; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.DataProviderMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.SetupTeardownType; /** * A {@link TreeScanner} which will scan a {@link com.sun.source.tree.CompilationUnitTree} and @@ -34,13 +34,13 @@ * *

This data can be retrieved using {@link #collectMetadataForClasses(CompilationUnitTree)}. */ -final class TestNGScanner extends TreeScanner<@Nullable Void, TestNGMetadata.Builder> { +final class TestNGScanner extends TreeScanner<@Nullable Void, TestNgMetadata.Builder> { private static final Matcher TESTNG_TEST_METHOD = anyOf( hasAnnotation("org.testng.annotations.Test"), allOf(hasModifier(Modifier.PUBLIC), not(hasModifier(Modifier.STATIC)))); - private final ImmutableMap.Builder metadataBuilder = + private final ImmutableMap.Builder metadataBuilder = ImmutableMap.builder(); private final VisitorState state; @@ -49,10 +49,10 @@ final class TestNGScanner extends TreeScanner<@Nullable Void, TestNGMetadata.Bui } @Override - public @Nullable Void visitClass(ClassTree tree, TestNGMetadata.Builder unused) { - TestNGMetadata.Builder builder = TestNGMetadata.builder(); + public @Nullable Void visitClass(ClassTree tree, TestNgMetadata.Builder unused) { + TestNgMetadata.Builder builder = TestNgMetadata.builder(); builder.setClassTree(tree); - getTestNGAnnotation(tree, state).ifPresent(builder::setClassLevelAnnotationMetadata); + getTestNgAnnotation(tree, state).ifPresent(builder::setClassLevelAnnotationMetadata); super.visitClass(tree, builder); metadataBuilder.put(tree, builder.build()); @@ -60,7 +60,7 @@ final class TestNGScanner extends TreeScanner<@Nullable Void, TestNGMetadata.Bui } @Override - public @Nullable Void visitMethod(MethodTree tree, TestNGMetadata.Builder builder) { + public @Nullable Void visitMethod(MethodTree tree, TestNgMetadata.Builder builder) { if (ASTHelpers.isGeneratedConstructor(tree)) { return super.visitMethod(tree, builder); } @@ -79,7 +79,7 @@ final class TestNGScanner extends TreeScanner<@Nullable Void, TestNGMetadata.Bui } if (TESTNG_TEST_METHOD.matches(tree, state)) { - getTestNGAnnotation(tree, state) + getTestNgAnnotation(tree, state) .or(builder::getClassLevelAnnotationMetadata) .ifPresent(annotation -> builder.methodAnnotationsBuilder().put(tree, annotation)); } @@ -87,14 +87,14 @@ final class TestNGScanner extends TreeScanner<@Nullable Void, TestNGMetadata.Bui return super.visitMethod(tree, builder); } - public ImmutableMap collectMetadataForClasses( + public ImmutableMap collectMetadataForClasses( CompilationUnitTree tree) { scan(tree, null); return metadataBuilder.build(); } @CanIgnoreReturnValue - private static Optional getTestNGAnnotation(Tree tree, VisitorState state) { + private static Optional getTestNgAnnotation(Tree tree, VisitorState state) { return ASTHelpers.getAnnotations(tree).stream() .filter(annotation -> TESTNG_TEST_ANNOTATION.matches(annotation, state)) .findFirst() diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGMetadata.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNgMetadata.java similarity index 94% rename from testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGMetadata.java rename to testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNgMetadata.java index 91ea3726560..ce2b90b7ee0 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNGMetadata.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TestNgMetadata.java @@ -24,7 +24,7 @@ * TestNGJUnitMigration}. */ @AutoValue -abstract class TestNGMetadata { +abstract class TestNgMetadata { abstract ClassTree getClassTree(); abstract Optional getClassLevelAnnotationMetadata(); @@ -70,7 +70,7 @@ final Optional getAnnotation(MethodTree methodTree) { } static Builder builder() { - return new AutoValue_TestNGMetadata.Builder(); + return new AutoValue_TestNgMetadata.Builder(); } @AutoValue.Builder @@ -93,7 +93,7 @@ abstract static class Builder { abstract Builder setDataProviderMetadata(ImmutableMap value); - abstract TestNGMetadata build(); + abstract TestNgMetadata build(); } /** @@ -125,7 +125,7 @@ public abstract static class AnnotationMetadata { */ public static AnnotationMetadata create( AnnotationTree annotationTree, ImmutableMap attributes) { - return new AutoValue_TestNGMetadata_AnnotationMetadata(annotationTree, attributes); + return new AutoValue_TestNgMetadata_AnnotationMetadata(annotationTree, attributes); } } @@ -166,9 +166,9 @@ public enum SetupTeardownType { private final boolean requiresStaticMethod; SetupTeardownType( - String testNGAnnotationClass, String junitAnnotationClass, boolean requiresStaticMethod) { - annotationMatcher = isType(testNGAnnotationClass); - methodTreeMatcher = hasAnnotation(testNGAnnotationClass); + String testNgAnnotationClass, String junitAnnotationClass, boolean requiresStaticMethod) { + annotationMatcher = isType(testNgAnnotationClass); + methodTreeMatcher = hasAnnotation(testNgAnnotationClass); this.junitAnnotationClass = junitAnnotationClass; this.requiresStaticMethod = requiresStaticMethod; } @@ -209,7 +209,7 @@ public abstract static class DataProviderMetadata { * @return A new {@link DataProviderMetadata} instance. */ public static DataProviderMetadata create(MethodTree methodTree) { - return new AutoValue_TestNGMetadata_DataProviderMetadata( + return new AutoValue_TestNgMetadata_DataProviderMetadata( methodTree, methodTree.getName().toString()); } } diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TimeOutAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TimeOutAttributeMigrator.java index 03edda73516..206e8f25d76 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TimeOutAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/TimeOutAttributeMigrator.java @@ -17,8 +17,8 @@ final class TimeOutAttributeMigrator implements AttributeMigrator { @Override public Optional migrate( - TestNGMetadata metadata, - TestNGMetadata.AnnotationMetadata annotation, + TestNgMetadata metadata, + TestNgMetadata.AnnotationMetadata annotation, MethodTree methodTree, VisitorState state) { return Optional.ofNullable(annotation.getAttributes().get("timeOut")) diff --git a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/UnsupportedAttributeMigrator.java b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/UnsupportedAttributeMigrator.java index 019fd2adeee..ddb31fe4a39 100644 --- a/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/UnsupportedAttributeMigrator.java +++ b/testng-junit-migrator/src/main/java/tech/picnic/errorprone/testngjunit/UnsupportedAttributeMigrator.java @@ -16,7 +16,7 @@ final class UnsupportedAttributeMigrator { private UnsupportedAttributeMigrator() {} static Optional migrate( - TestNGMetadata.AnnotationMetadata annotation, + TestNgMetadata.AnnotationMetadata annotation, MethodTree methodTree, String attributeName, VisitorState state) { diff --git a/testng-junit-migrator/src/test/java/tech/picnic/errorprone/testngjunit/TestNGScannerTest.java b/testng-junit-migrator/src/test/java/tech/picnic/errorprone/testngjunit/TestNGScannerTest.java index 42e04d713c5..035df76cc0d 100644 --- a/testng-junit-migrator/src/test/java/tech/picnic/errorprone/testngjunit/TestNGScannerTest.java +++ b/testng-junit-migrator/src/test/java/tech/picnic/errorprone/testngjunit/TestNGScannerTest.java @@ -21,7 +21,7 @@ import java.util.Optional; import javax.lang.model.element.Name; import org.junit.jupiter.api.Test; -import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata; +import tech.picnic.errorprone.testngjunit.TestNgMetadata.AnnotationMetadata; final class TestNGScannerTest { @Test @@ -167,7 +167,7 @@ public static final class TestChecker extends BugChecker implements CompilationUnitTreeMatcher, ClassTreeMatcher, MethodTreeMatcher { private static final long serialVersionUID = 1L; // XXX: find better way to do this - private ImmutableMap classMetaData = ImmutableMap.of(); + private ImmutableMap classMetaData = ImmutableMap.of(); @Override public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState state) { @@ -180,7 +180,7 @@ public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState s @Override public Description matchClass(ClassTree tree, VisitorState state) { Optional.ofNullable(classMetaData.get(tree)) - .flatMap(TestNGMetadata::getClassLevelAnnotationMetadata) + .flatMap(TestNgMetadata::getClassLevelAnnotationMetadata) .ifPresent(annotation -> reportAnnotationMessage(tree, annotation, state)); return Description.NO_MATCH; } @@ -188,7 +188,7 @@ public Description matchClass(ClassTree tree, VisitorState state) { @Override public Description matchMethod(MethodTree tree, VisitorState state) { ClassTree classTree = state.findEnclosing(ClassTree.class); - Optional metadata = Optional.ofNullable(classTree).map(classMetaData::get); + Optional metadata = Optional.ofNullable(classTree).map(classMetaData::get); if (metadata.isEmpty()) { return Description.NO_MATCH; @@ -203,14 +203,14 @@ public Description matchMethod(MethodTree tree, VisitorState state) { } private void reportClassLevelAnnotation( - ClassTree classTree, TestNGMetadata metadata, VisitorState state) { + ClassTree classTree, TestNgMetadata metadata, VisitorState state) { metadata .getClassLevelAnnotationMetadata() .ifPresent(annotation -> reportAnnotationMessage(classTree, annotation, state)); } private void reportTestMethods( - MethodTree tree, ClassTree classTree, TestNGMetadata metadata, VisitorState state) { + MethodTree tree, ClassTree classTree, TestNgMetadata metadata, VisitorState state) { metadata .getClassLevelAnnotationMetadata() .filter(not(isEqual(metadata.getMethodAnnotations().get(tree)))) @@ -219,7 +219,7 @@ private void reportTestMethods( } private void reportSetupTeardownMethods( - MethodTree tree, ClassTree classTree, TestNGMetadata metadata, VisitorState state) { + MethodTree tree, ClassTree classTree, TestNgMetadata metadata, VisitorState state) { metadata.getSetupTeardown().entrySet().stream() .filter(entry -> entry.getKey().equals(tree)) .findFirst() @@ -234,7 +234,7 @@ private void reportSetupTeardownMethods( } private void reportDataProviderMethods( - MethodTree tree, ClassTree classTree, TestNGMetadata metadata, VisitorState state) { + MethodTree tree, ClassTree classTree, TestNgMetadata metadata, VisitorState state) { metadata.getDataProviderMetadata().entrySet().stream() .filter(entry -> entry.getValue().getMethodTree().equals(tree)) .findFirst()