Skip to content

Commit

Permalink
Flatten package structure
Browse files Browse the repository at this point in the history
  • Loading branch information
oxkitsune committed Feb 27, 2023
1 parent 7fed976 commit ab336f2
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 28 deletions.
2 changes: 1 addition & 1 deletion testng-junit-migrator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ This script will:
2. Add the required `JUnit` dependencies to your `pom.xml`
3. Run the `testng-to-junit` migration
4. Run the migrated JUnit tests and count the number of completed tests
5. Display the difference in the amount of completed tests.
5. Display the difference in the amount of completed tests.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.picnic.errorprone.testngjunit.migrators.argument;
package tech.picnic.errorprone.testngjunit;

import com.google.errorprone.VisitorState;
import com.google.errorprone.annotations.Immutable;
Expand All @@ -10,12 +10,10 @@
import com.sun.source.tree.Tree;
import java.util.Optional;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;
import tech.picnic.errorprone.testngjunit.Migrator;
import tech.picnic.errorprone.testngjunit.TestNGMetadata;

/** An {@link Migrator} that migrates the {@code dataProvider} argument. */
@Immutable
public final class DataProviderArgumentMigrator implements Migrator {
final class DataProviderArgumentMigrator implements Migrator {
@Override
public Optional<SuggestedFix> createFix(
ClassTree classTree, MethodTree methodTree, ExpressionTree dataValue, VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.picnic.errorprone.testngjunit.migrators;
package tech.picnic.errorprone.testngjunit;

import static com.sun.source.tree.Tree.Kind.NEW_ARRAY;
import static java.util.stream.Collectors.joining;
Expand All @@ -23,7 +23,7 @@
import tech.picnic.errorprone.bugpatterns.util.SourceCode;

/** A helper class that migrates a TestNG {@code DataProvider} to a JUnit {@code MethodSource}. */
public final class DataProviderMigrator {
final class DataProviderMigrator {
/**
* Create the {@link SuggestedFix} required to migrate a TestNG {@code DataProvider} to a JUnit
* {@code MethodSource}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.picnic.errorprone.testngjunit.migrators.argument;
package tech.picnic.errorprone.testngjunit;

import com.google.errorprone.VisitorState;
import com.google.errorprone.annotations.Immutable;
Expand All @@ -8,12 +8,10 @@
import com.sun.source.tree.MethodTree;
import java.util.Optional;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;
import tech.picnic.errorprone.testngjunit.Migrator;
import tech.picnic.errorprone.testngjunit.TestNGMetadata;

/** An {@link Migrator} that migrates the {@code description} argument. */
@Immutable
public final class DescriptionArgumentMigrator implements Migrator {
final class DescriptionArgumentMigrator implements Migrator {
@Override
public Optional<SuggestedFix> createFix(
ClassTree classTree, MethodTree methodTree, ExpressionTree dataValue, VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.picnic.errorprone.testngjunit.migrators.argument;
package tech.picnic.errorprone.testngjunit;

import static com.google.auto.common.MoreStreams.toImmutableList;
import static com.sun.source.tree.Tree.Kind.MEMBER_SELECT;
Expand All @@ -15,12 +15,10 @@
import com.sun.source.tree.NewArrayTree;
import java.util.Optional;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;
import tech.picnic.errorprone.testngjunit.Migrator;
import tech.picnic.errorprone.testngjunit.TestNGMetadata;

/** An {@link Migrator} that migrates the {@code expectedExceptions} argument. */
@Immutable
public final class ExpectedExceptionsArgumentMigrator implements Migrator {
final class ExpectedExceptionsArgumentMigrator implements Migrator {
@Override
public Optional<SuggestedFix> createFix(
ClassTree classTree, MethodTree methodTree, ExpressionTree dataValue, VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* {@code Test} annotation to JUnit.
*/
@Immutable
public interface Migrator {
interface Migrator {
/**
* Attempt to create a {@link SuggestedFix}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.picnic.errorprone.testngjunit.migrators.argument;
package tech.picnic.errorprone.testngjunit;

import com.google.errorprone.VisitorState;
import com.google.errorprone.annotations.Immutable;
Expand All @@ -8,12 +8,10 @@
import com.sun.source.tree.MethodTree;
import java.util.Optional;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;
import tech.picnic.errorprone.testngjunit.Migrator;
import tech.picnic.errorprone.testngjunit.TestNGMetadata;

/** An {@link Migrator} that migrates the {@code priority} argument. */
@Immutable
public final class PriorityArgumentMigrator implements Migrator {
final class PriorityArgumentMigrator implements Migrator {
@Override
public Optional<SuggestedFix> createFix(
ClassTree classTree, MethodTree methodTree, ExpressionTree dataValue, VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import static java.util.Arrays.stream;

import java.util.Optional;
import tech.picnic.errorprone.testngjunit.migrators.argument.DataProviderArgumentMigrator;
import tech.picnic.errorprone.testngjunit.migrators.argument.DescriptionArgumentMigrator;
import tech.picnic.errorprone.testngjunit.migrators.argument.ExpectedExceptionsArgumentMigrator;
import tech.picnic.errorprone.testngjunit.migrators.argument.PriorityArgumentMigrator;

/** The annotation argument kinds that are supported by the TestNG -> JUnit migration. */
enum SupportedArgumentKind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Optional;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.testngjunit.TestNGMetadata.AnnotationMetadata;
import tech.picnic.errorprone.testngjunit.migrators.DataProviderMigrator;

/**
* A {@link BugChecker} that migrates TestNG unit tests to JUnit 5.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* <p>These constants and methods are additions to the ones found in {@link
* com.google.errorprone.matchers.TestNgMatchers}.
*/
public final class TestNGMatchers {
final class TestNGMatchers {
/**
* Matches the TestNG {@code Test} annotation specifically. As {@link
* com.google.errorprone.matchers.TestNgMatchers#hasTestNgAnnotation(ClassTree)} also other TestNG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* TestNGJUnitMigration}.
*/
@AutoValue
public abstract class TestNGMetadata {
abstract class TestNGMetadata {
abstract ClassTree getClassTree();

abstract Optional<AnnotationMetadata> getClassLevelAnnotationMetadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.sun.source.util.TreeScanner;
import java.util.Optional;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.testngjunit.migrators.DataProviderMigrator;

/**
* A {@link TreeScanner} which will scan a {@link com.sun.source.tree.CompilationUnitTree} and
Expand Down

0 comments on commit ab336f2

Please sign in to comment.