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()