Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unnecessary BugCheckerRefactoringTestHelper file path prefixes #248

Merged
merged 3 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import com.fasterxml.jackson.annotation.JsonCreator;",
"",
"enum A {",
Expand All @@ -132,7 +132,7 @@ void replacement() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import com.fasterxml.jackson.annotation.JsonCreator;",
"",
"enum A {",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/Container.java",
"Container.java",
"import org.springframework.beans.factory.annotation.Autowired;",
"",
"interface Container {",
Expand All @@ -89,7 +89,7 @@ void replacement() {
" }",
"}")
.addOutputLines(
"out/Container.java",
"Container.java",
"import org.springframework.beans.factory.annotation.Autowired;",
"",
"interface Container {",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/pkg/A.java",
"pkg/A.java",
"package pkg;",
"",
"import pkg.A.Foo;",
Expand Down Expand Up @@ -206,7 +206,7 @@ void replacement() {
" A trailingComma3();",
"}")
.addOutputLines(
"out/pkg/A.java",
"pkg/A.java",
"package pkg;",
"",
"import pkg.A.Foo;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"final class A {",
" void instanceMethod() {}",
"",
" static void staticMethod() {}",
"}")
.addOutputLines("out/A.java", "final class A {}")
.addOutputLines("A.java", "final class A {}")
.doTest(TestMode.TEXT_MATCH);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ void identification() {
"",
" refactoringTestHelper",
" // BUG: Diagnostic contains: Test code should follow the Google Java style",
" .addInputLines(\"in/A.java\", \"class A { }\")",
" .addInputLines(\"A.java\", \"class A { }\")",
" // BUG: Diagnostic contains: Test code should follow the Google Java style",
" .addOutputLines(\"out/A.java\", \"class A { }\")",
" .addOutputLines(\"A.java\", \"class A { }\")",
" // BUG: Diagnostic contains: Test code should follow the Google Java style",
" .addInputLines(\"in/B.java\", \"import java.util.Map;\", \"\", \"class B {}\")",
" .addInputLines(\"B.java\", \"import java.util.Map;\", \"\", \"class B {}\")",
" // Unused import, but in an output file, so not flagged.",
" .addOutputLines(\"out/B.java\", \"import java.util.Map;\", \"\", \"class B {}\")",
" .addOutputLines(\"B.java\", \"import java.util.Map;\", \"\", \"class B {}\")",
" .doTest(TestMode.TEXT_MATCH);",
" }",
"}")
Expand All @@ -65,7 +65,7 @@ void replacement() {
*/
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import com.google.errorprone.BugCheckerRefactoringTestHelper;",
"import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;",
"import com.google.errorprone.CompilationTestHelper;",
Expand All @@ -90,14 +90,14 @@ void replacement() {
"",
" refactoringTestHelper",
" .addInputLines(",
" \"in/A.java\",",
" \"A.java\",",
" \"import java.util.Map;\",",
" \"import java.util.Collection;\",",
" \"import java.util.List;\",",
" \"\",",
" \"interface A extends List<A>, Map<A,A> { }\")",
" .addOutputLines(",
" \"out/A.java\",",
" \"A.java\",",
" \"import java.util.Map;\",",
" \"import java.util.Collection;\",",
" \"import java.util.List;\",",
Expand All @@ -107,7 +107,7 @@ void replacement() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import com.google.errorprone.BugCheckerRefactoringTestHelper;",
"import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;",
"import com.google.errorprone.CompilationTestHelper;",
Expand All @@ -131,13 +131,13 @@ void replacement() {
"",
" refactoringTestHelper",
" .addInputLines(",
" \"in/A.java\",",
" \"A.java\",",
" \"import java.util.List;\",",
" \"import java.util.Map;\",",
" \"\",",
" \"interface A extends List<A>, Map<A, A> {}\")",
" .addOutputLines(",
" \"out/A.java\",",
" \"A.java\",",
" \"import java.util.Collection;\",",
" \"import java.util.List;\",",
" \"import java.util.Map;\",",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void replacementFirstSuggestedFix() {
refactoringTestHelper
.setFixChooser(FixChoosers.FIRST)
.addInputLines(
"in/A.java",
"A.java",
"import reactor.core.publisher.Flux;",
"",
"class A {",
Expand All @@ -77,7 +77,7 @@ void replacementFirstSuggestedFix() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import reactor.core.publisher.Flux;",
"",
"class A {",
Expand All @@ -94,7 +94,7 @@ void replacementSecondSuggestedFix() {
refactoringTestHelper
.setFixChooser(FixChoosers.SECOND)
.addInputLines(
"in/A.java",
"A.java",
"import reactor.core.publisher.Flux;",
"",
"class A {",
Expand All @@ -106,7 +106,7 @@ void replacementSecondSuggestedFix() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import reactor.core.publisher.Flux;",
"",
"class A {",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import static com.google.common.base.Preconditions.checkArgument;",
"import static org.assertj.core.api.Assertions.assertThat;",
"",
Expand Down Expand Up @@ -360,7 +360,7 @@ void replacement() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import static com.google.common.base.Preconditions.checkArgument;",
"import static org.assertj.core.api.Assertions.assertThat;",
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import static org.junit.jupiter.params.provider.Arguments.arguments;",
"",
"import org.junit.jupiter.api.AfterAll;",
Expand Down Expand Up @@ -363,7 +363,7 @@ void replacement() {
" private void testClass() {}",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import static org.junit.jupiter.params.provider.Arguments.arguments;",
"",
"import org.junit.jupiter.api.AfterAll;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import static java.math.RoundingMode.DOWN;",
"import static java.math.RoundingMode.UP;",
"",
Expand Down Expand Up @@ -204,7 +204,7 @@ void replacement() {
" A unsortedInnderAnns();",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import static java.math.RoundingMode.DOWN;",
"import static java.math.RoundingMode.UP;",
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import java.lang.annotation.Repeatable;",
"",
"interface A {",
Expand Down Expand Up @@ -176,7 +176,7 @@ void replacement() {
" A unsortedRepeatableAnnotation();",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import java.lang.annotation.Repeatable;",
"",
"interface A {",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import static java.util.Collections.emptyList;",
"",
"import java.util.Collections;",
Expand Down Expand Up @@ -378,7 +378,7 @@ void replacement() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import static java.util.Collections.emptyList;",
"",
"import java.util.Collections;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void identification() {
void replacement() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import static org.mockito.ArgumentMatchers.eq;",
"import static org.mockito.Mockito.doAnswer;",
"import static org.mockito.Mockito.mock;",
Expand All @@ -80,7 +80,7 @@ void replacement() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import static org.mockito.ArgumentMatchers.eq;",
"import static org.mockito.Mockito.doAnswer;",
"import static org.mockito.Mockito.mock;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void stringComparison() {
void replacementWithPrimitiveVariants() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand Down Expand Up @@ -536,7 +536,7 @@ void replacementWithPrimitiveVariants() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand Down Expand Up @@ -579,7 +579,7 @@ void replacementWithPrimitiveVariants() {
void replacementWithBoxedVariants() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand Down Expand Up @@ -609,7 +609,7 @@ void replacementWithBoxedVariants() {
" }",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand Down Expand Up @@ -645,7 +645,7 @@ void replacementWithBoxedVariants() {
void replacementWithPrimitiveVariantsUsingStaticImports() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import static java.util.Comparator.comparing;",
"",
"import java.util.Comparator;",
Expand All @@ -660,7 +660,7 @@ void replacementWithPrimitiveVariantsUsingStaticImports() {
" Comparator<A> dCmp = comparing(o -> 0.0);",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import static java.util.Comparator.comparing;",
"import static java.util.Comparator.comparingDouble;",
"import static java.util.Comparator.comparingInt;",
Expand All @@ -684,7 +684,7 @@ void replacementWithPrimitiveVariantsUsingStaticImports() {
void replacementWithBoxedVariantsUsingStaticImports() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import static java.util.Comparator.comparingDouble;",
"import static java.util.Comparator.comparingInt;",
"import static java.util.Comparator.comparingLong;",
Expand All @@ -701,7 +701,7 @@ void replacementWithBoxedVariantsUsingStaticImports() {
" Comparator<A> dCmp = comparingDouble(o -> Double.valueOf(0));",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import static java.util.Comparator.comparing;",
"import static java.util.Comparator.comparingDouble;",
"import static java.util.Comparator.comparingInt;",
Expand All @@ -725,7 +725,7 @@ void replacementWithBoxedVariantsUsingStaticImports() {
void replacementWithPrimitiveVariantsInComplexSyntacticalContext() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand All @@ -738,7 +738,7 @@ void replacementWithPrimitiveVariantsInComplexSyntacticalContext() {
" Comparator<A> dCmp = Comparator.<A, A>comparing(o -> o).thenComparing(o -> 0.0);",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand All @@ -757,7 +757,7 @@ void replacementWithPrimitiveVariantsInComplexSyntacticalContext() {
void replacementWithBoxedVariantsInComplexSyntacticalContext() {
refactoringTestHelper
.addInputLines(
"in/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand All @@ -775,7 +775,7 @@ void replacementWithBoxedVariantsInComplexSyntacticalContext() {
" Comparator.<A, A>comparing(o -> o).thenComparingDouble(o -> Double.valueOf(0));",
"}")
.addOutputLines(
"out/A.java",
"A.java",
"import java.util.Comparator;",
"",
"interface A extends Comparable<A> {",
Expand Down
Loading