diff --git a/core/src/test/java/com/google/errorprone/CommandLineFlagTest.java b/core/src/test/java/com/google/errorprone/CommandLineFlagTest.java index 767fbf09537d..e2b20e914d64 100644 --- a/core/src/test/java/com/google/errorprone/CommandLineFlagTest.java +++ b/core/src/test/java/com/google/errorprone/CommandLineFlagTest.java @@ -170,7 +170,7 @@ public void canPromoteToError() { ErrorProneTestCompiler compiler = builder.report(ScannerSupplier.fromBugCheckerClasses(WarningChecker.class)).build(); ImmutableList sources = - forResources(getClass(), "CommandLineFlagTestFile.java"); + forResources(getClass(), "testdata/CommandLineFlagTestFile.java"); Result exitCode = compiler.compile(sources); assertThat(exitCode).isEqualTo(Result.OK); @@ -185,7 +185,7 @@ public void canDemoteToWarning() { ErrorProneTestCompiler compiler = builder.report(ScannerSupplier.fromBugCheckerClasses(ErrorChecker.class)).build(); ImmutableList sources = - forResources(getClass(), "CommandLineFlagTestFile.java"); + forResources(getClass(), "testdata/CommandLineFlagTestFile.java"); Result exitCode = compiler.compile(sources); assertThat(exitCode).isEqualTo(Result.ERROR); @@ -201,7 +201,7 @@ public void canDisable() { ErrorProneTestCompiler compiler = builder.report(ScannerSupplier.fromBugCheckerClasses(DisableableChecker.class)).build(); ImmutableList sources = - forResources(getClass(), "CommandLineFlagTestFile.java"); + forResources(getClass(), "testdata/CommandLineFlagTestFile.java"); Result exitCode = compiler.compile(sources); assertThat(exitCode).isEqualTo(Result.ERROR); @@ -217,7 +217,7 @@ public void cantDisableNondisableableCheck() { ErrorProneTestCompiler compiler = builder.report(ScannerSupplier.fromBugCheckerClasses(NondisableableChecker.class)).build(); ImmutableList sources = - forResources(getClass(), "CommandLineFlagTestFile.java"); + forResources(getClass(), "testdata/CommandLineFlagTestFile.java"); InvalidCommandLineOptionException expected = assertThrows( @@ -230,7 +230,7 @@ public void cantDisableNondisableableCheck() { public void cantOverrideNonexistentCheck() { ErrorProneTestCompiler compiler = builder.build(); ImmutableList sources = - forResources(getClass(), "CommandLineFlagTestFile.java"); + forResources(getClass(), "testdata/CommandLineFlagTestFile.java"); List badOptions = Arrays.asList( "-Xep:BogusChecker:ERROR", @@ -251,7 +251,7 @@ public void cantOverrideNonexistentCheck() { public void ignoreUnknownChecksFlagAllowsOverridingUnknownCheck() { ErrorProneTestCompiler compiler = builder.build(); ImmutableList sources = - forResources(getClass(), "CommandLineFlagTestFile.java"); + forResources(getClass(), "testdata/CommandLineFlagTestFile.java"); List badOptions = Arrays.asList( "-Xep:BogusChecker:ERROR", diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ArrayEqualsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ArrayEqualsTest.java index eac2c3c9a48b..e62daab7719d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ArrayEqualsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ArrayEqualsTest.java @@ -32,21 +32,21 @@ public class ArrayEqualsTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ArrayEqualsPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayEqualsPositiveCases.java").doTest(); } @Test public void java7PositiveCase() { - compilationHelper.addSourceFile("ArrayEqualsPositiveCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayEqualsPositiveCases2.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ArrayEqualsNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayEqualsNegativeCases.java").doTest(); } @Test public void java7NegativeCase() { - compilationHelper.addSourceFile("ArrayEqualsNegativeCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayEqualsNegativeCases2.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ArrayHashCodeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ArrayHashCodeTest.java index ddc47d37ae80..da52cd2dbb11 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ArrayHashCodeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ArrayHashCodeTest.java @@ -32,17 +32,17 @@ public class ArrayHashCodeTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ArrayHashCodePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayHashCodePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ArrayHashCodeNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayHashCodeNegativeCases.java").doTest(); } /** Tests java.util.Objects hashCode methods, which are only in JDK 7 and above. */ @Test public void java7NegativeCase() { - compilationHelper.addSourceFile("ArrayHashCodeNegativeCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayHashCodeNegativeCases2.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ArrayToStringTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ArrayToStringTest.java index 28a5ea14d7cb..79e28d1e628a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ArrayToStringTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ArrayToStringTest.java @@ -34,12 +34,12 @@ public class ArrayToStringTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ArrayToStringPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayToStringPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ArrayToStringNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ArrayToStringNegativeCases.java").doTest(); } @Test @@ -194,22 +194,30 @@ void test(Exception e) { @Test public void positiveCompoundAssignment() { - compilationHelper.addSourceFile("ArrayToStringCompoundAssignmentPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ArrayToStringCompoundAssignmentPositiveCases.java") + .doTest(); } @Test public void negativeCompoundAssignment() { - compilationHelper.addSourceFile("ArrayToStringCompoundAssignmentNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ArrayToStringCompoundAssignmentNegativeCases.java") + .doTest(); } @Test public void positiveConcat() { - compilationHelper.addSourceFile("ArrayToStringConcatenationPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ArrayToStringConcatenationPositiveCases.java") + .doTest(); } @Test public void negativeConcat() { - compilationHelper.addSourceFile("ArrayToStringConcatenationNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ArrayToStringConcatenationNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/AssertFalseTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/AssertFalseTest.java index aa953941a351..b6f946145509 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/AssertFalseTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/AssertFalseTest.java @@ -32,11 +32,11 @@ public class AssertFalseTest { @Test public void negativeCase() { - compilationHelper.addSourceFile("AssertFalseNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AssertFalseNegativeCases.java").doTest(); } @Test public void positiveCase() { - compilationHelper.addSourceFile("AssertFalsePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AssertFalsePositiveCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/AsyncFunctionReturnsNullTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/AsyncFunctionReturnsNullTest.java index 77225e168490..5dda741ad08c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/AsyncFunctionReturnsNullTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/AsyncFunctionReturnsNullTest.java @@ -29,11 +29,11 @@ public class AsyncFunctionReturnsNullTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("AsyncFunctionReturnsNullPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AsyncFunctionReturnsNullPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("AsyncFunctionReturnsNullNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AsyncFunctionReturnsNullNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/BadComparableTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/BadComparableTest.java index 5a8007066fb0..985c47d3d213 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/BadComparableTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/BadComparableTest.java @@ -31,11 +31,11 @@ public class BadComparableTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("BadComparablePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BadComparablePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("BadComparableNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BadComparableNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/BadImportTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/BadImportTest.java index 83bba2b43fd7..c0ccd5677565 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/BadImportTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/BadImportTest.java @@ -181,7 +181,7 @@ void foo() { @Test public void positive_nested() { - compilationTestHelper.addSourceFile("BadImportPositiveCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/BadImportPositiveCases.java").doTest(); } @Test @@ -262,7 +262,7 @@ static class B {} @Test public void negative_nested() { - compilationTestHelper.addSourceFile("BadImportNegativeCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/BadImportNegativeCases.java").doTest(); } @Test @@ -284,8 +284,8 @@ public void negative_badImportIsTopLevelClass() { @Test public void nestedFixes() { refactoringTestHelper - .addInput("BadImportPositiveCases.java") - .addOutput("BadImportPositiveCases_expected.java") + .addInput("testdata/BadImportPositiveCases.java") + .addOutput("testdata/BadImportPositiveCases_expected.java") .doTest(TestMode.AST_MATCH); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/BadShiftAmountTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/BadShiftAmountTest.java index 1742822f515c..c962aaf1c69f 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/BadShiftAmountTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/BadShiftAmountTest.java @@ -32,11 +32,11 @@ public class BadShiftAmountTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("BadShiftAmountPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BadShiftAmountPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("BadShiftAmountNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BadShiftAmountNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/BanClassLoaderTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/BanClassLoaderTest.java index fc1118f7655e..383813d110a4 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/BanClassLoaderTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/BanClassLoaderTest.java @@ -33,11 +33,11 @@ public class BanClassLoaderTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("BanClassLoaderPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BanClassLoaderPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("BanClassLoaderNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BanClassLoaderNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/BanJNDITest.java b/core/src/test/java/com/google/errorprone/bugpatterns/BanJNDITest.java index 6df39d6f09aa..bffc2e6e6dbb 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/BanJNDITest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/BanJNDITest.java @@ -33,18 +33,18 @@ public class BanJNDITest { @Test public void positiveCase() { - compilationHelper.addSourceFile("BanJNDIPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BanJNDIPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("BanJNDINegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BanJNDINegativeCases.java").doTest(); } @Test public void negativeCaseUnchanged() { refactoringHelper - .addInput("BanJNDINegativeCases.java") + .addInput("testdata/BanJNDINegativeCases.java") .expectUnchanged() .setArgs("-XepCompilingTestOnlyCode") .doTest(); diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/BanSerializableReadTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/BanSerializableReadTest.java index 26cc3aeaa4fc..081d4b768198 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/BanSerializableReadTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/BanSerializableReadTest.java @@ -33,18 +33,18 @@ public class BanSerializableReadTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("BanSerializableReadPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BanSerializableReadPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("BanSerializableReadNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/BanSerializableReadNegativeCases.java").doTest(); } @Test public void negativeCaseUnchanged() { refactoringHelper - .addInput("BanSerializableReadNegativeCases.java") + .addInput("testdata/BanSerializableReadNegativeCases.java") .expectUnchanged() .setArgs("-XepCompilingTestOnlyCode") .doTest(); diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ByteBufferBackingArrayTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ByteBufferBackingArrayTest.java index 1c4b97b3660b..8a02e1c993d0 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ByteBufferBackingArrayTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ByteBufferBackingArrayTest.java @@ -30,12 +30,12 @@ public class ByteBufferBackingArrayTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("ByteBufferBackingArrayPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ByteBufferBackingArrayPositiveCases.java").doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("ByteBufferBackingArrayNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ByteBufferBackingArrayNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/CannotMockFinalClassTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/CannotMockFinalClassTest.java index 6a2c5f643421..19a9eddcb651 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/CannotMockFinalClassTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/CannotMockFinalClassTest.java @@ -35,7 +35,7 @@ public class CannotMockFinalClassTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("CannotMockFinalClassPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/CannotMockFinalClassPositiveCases.java").doTest(); } @Test @@ -64,11 +64,11 @@ record Record() {} @Test public void negativeCase() { - compilationHelper.addSourceFile("CannotMockFinalClassNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/CannotMockFinalClassNegativeCases.java").doTest(); } @Test public void negativeCase2() { - compilationHelper.addSourceFile("CannotMockFinalClassNegativeCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/CannotMockFinalClassNegativeCases2.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContextTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContextTest.java index 19adf35a3996..e1850d785066 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContextTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContextTest.java @@ -31,11 +31,15 @@ public class ChainedAssertionLosesContextTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ChainedAssertionLosesContextPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ChainedAssertionLosesContextPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ChainedAssertionLosesContextNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ChainedAssertionLosesContextNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ChainingConstructorIgnoresParameterTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ChainingConstructorIgnoresParameterTest.java index 0d41839cdb8a..e9e3506aac7d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ChainingConstructorIgnoresParameterTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ChainingConstructorIgnoresParameterTest.java @@ -32,14 +32,14 @@ public class ChainingConstructorIgnoresParameterTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("ChainingConstructorIgnoresParameterPositiveCases.java") + .addSourceFile("testdata/ChainingConstructorIgnoresParameterPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("ChainingConstructorIgnoresParameterNegativeCases.java") + .addSourceFile("testdata/ChainingConstructorIgnoresParameterNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java index 60ce86f3c480..22abdb7d2e76 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java @@ -47,7 +47,7 @@ public class CheckReturnValueTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("CheckReturnValuePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/CheckReturnValuePositiveCases.java").doTest(); } @Test @@ -108,7 +108,7 @@ public void doIt() { @Test public void negativeCase() { - compilationHelper.addSourceFile("CheckReturnValueNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/CheckReturnValueNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ClassCanBeStaticTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ClassCanBeStaticTest.java index b1268f53b5c0..d67daf15217c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ClassCanBeStaticTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ClassCanBeStaticTest.java @@ -33,24 +33,24 @@ public class ClassCanBeStaticTest { @Test public void negativeCase() { compilationHelper - .addSourceFile("ClassCanBeStaticNegativeCases.java") + .addSourceFile("testdata/ClassCanBeStaticNegativeCases.java") .setArgs("--release", "11") .doTest(); } @Test public void positiveCase1() { - compilationHelper.addSourceFile("ClassCanBeStaticPositiveCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/ClassCanBeStaticPositiveCase1.java").doTest(); } @Test public void positiveCase2() { - compilationHelper.addSourceFile("ClassCanBeStaticPositiveCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/ClassCanBeStaticPositiveCase2.java").doTest(); } @Test public void positiveCase3() { - compilationHelper.addSourceFile("ClassCanBeStaticPositiveCase3.java").doTest(); + compilationHelper.addSourceFile("testdata/ClassCanBeStaticPositiveCase3.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/CollectionToArraySafeParameterTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/CollectionToArraySafeParameterTest.java index e6470cbd9a98..caac3f2bee92 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/CollectionToArraySafeParameterTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/CollectionToArraySafeParameterTest.java @@ -30,12 +30,16 @@ public class CollectionToArraySafeParameterTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("CollectionToArraySafeParameterPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/CollectionToArraySafeParameterPositiveCases.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("CollectionToArraySafeParameterNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/CollectionToArraySafeParameterNegativeCases.java") + .doTest(); } // regression test for b/67022899 diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/CollectorShouldNotUseStateTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/CollectorShouldNotUseStateTest.java index fa452be5ca07..150bfc495c0f 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/CollectorShouldNotUseStateTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/CollectorShouldNotUseStateTest.java @@ -30,11 +30,15 @@ public class CollectorShouldNotUseStateTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("CollectorShouldNotUseStatePositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/CollectorShouldNotUseStatePositiveCases.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("CollectorShouldNotUseStateNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/CollectorShouldNotUseStateNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ComparableAndComparatorTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ComparableAndComparatorTest.java index 502ed5c62834..8fc918bea943 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ComparableAndComparatorTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ComparableAndComparatorTest.java @@ -31,11 +31,11 @@ public class ComparableAndComparatorTest { @Test public void positive() { - compilationHelper.addSourceFile("ComparableAndComparatorPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ComparableAndComparatorPositiveCases.java").doTest(); } @Test public void negative() { - compilationHelper.addSourceFile("ComparableAndComparatorNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ComparableAndComparatorNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ComparableTypeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ComparableTypeTest.java index 30542b687460..44b35dc3c0c4 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ComparableTypeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ComparableTypeTest.java @@ -28,11 +28,11 @@ public class ComparableTypeTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ComparableTypePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ComparableTypePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ComparableTypeNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ComparableTypeNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonContractViolatedTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonContractViolatedTest.java index 548ad97f0641..c5ed68e4cc2e 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonContractViolatedTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonContractViolatedTest.java @@ -31,11 +31,15 @@ public class ComparisonContractViolatedTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ComparisonContractViolatedPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ComparisonContractViolatedPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ComparisonContractViolatedNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ComparisonContractViolatedNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonOutOfRangeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonOutOfRangeTest.java index 75feb4d57178..299f3825dcb2 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonOutOfRangeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ComparisonOutOfRangeTest.java @@ -32,11 +32,11 @@ public class ComparisonOutOfRangeTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("ComparisonOutOfRangePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ComparisonOutOfRangePositiveCases.java").doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("ComparisonOutOfRangeNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ComparisonOutOfRangeNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/DeadExceptionTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/DeadExceptionTest.java index 4e2c1c5b9383..a2f9eca702fb 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/DeadExceptionTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/DeadExceptionTest.java @@ -32,12 +32,12 @@ public class DeadExceptionTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("DeadExceptionPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/DeadExceptionPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("DeadExceptionNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/DeadExceptionNegativeCases.java").doTest(); } /** @@ -46,6 +46,6 @@ public void negativeCase() { */ @Test public void negativeCaseWhenExceptionsUnthrownInTests() { - compilationHelper.addSourceFile("DeadExceptionTestingNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/DeadExceptionTestingNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/DepAnnTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/DepAnnTest.java index 00f1e0b843e3..81e9d440bb1d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/DepAnnTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/DepAnnTest.java @@ -32,17 +32,26 @@ public class DepAnnTest { @Test public void positiveCase() { - compilationHelper.setArgs(JAVACOPTS).addSourceFile("DepAnnPositiveCases.java").doTest(); + compilationHelper + .setArgs(JAVACOPTS) + .addSourceFile("testdata/DepAnnPositiveCases.java") + .doTest(); } @Test public void negativeCase1() { - compilationHelper.setArgs(JAVACOPTS).addSourceFile("DepAnnNegativeCase1.java").doTest(); + compilationHelper + .setArgs(JAVACOPTS) + .addSourceFile("testdata/DepAnnNegativeCase1.java") + .doTest(); } @Test public void negativeCase2() { - compilationHelper.setArgs(JAVACOPTS).addSourceFile("DepAnnNegativeCase2.java").doTest(); + compilationHelper + .setArgs(JAVACOPTS) + .addSourceFile("testdata/DepAnnNegativeCase2.java") + .doTest(); } @Test @@ -50,7 +59,7 @@ public void disableable() { compilationHelper .setArgs(ImmutableList.of("-Xlint:-dep-ann", "-Xep:DepAnn:OFF")) .expectNoDiagnostics() - .addSourceFile("DepAnnPositiveCases.java") + .addSourceFile("testdata/DepAnnPositiveCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/EmptyCatchTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/EmptyCatchTest.java index 96be7eb2fb28..0c2e0d1237d9 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/EmptyCatchTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/EmptyCatchTest.java @@ -37,12 +37,12 @@ public void setUp() { @Test public void positiveCase() throws Exception { - compilationHelper.addSourceFile("EmptyCatchPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EmptyCatchPositiveCases.java").doTest(); } @Test public void negativeCase() throws Exception { - compilationHelper.addSourceFile("EmptyCatchNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EmptyCatchNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/EmptyIfStatementTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/EmptyIfStatementTest.java index a8c97348fe50..63156143bdbd 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/EmptyIfStatementTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/EmptyIfStatementTest.java @@ -32,11 +32,11 @@ public class EmptyIfStatementTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("EmptyIfStatementPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EmptyIfStatementPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("EmptyIfStatementNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EmptyIfStatementNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsHashCodeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsHashCodeTest.java index 6a6c3858f570..a911c6ad8dff 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsHashCodeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsHashCodeTest.java @@ -30,12 +30,12 @@ public class EqualsHashCodeTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("EqualsHashCodeTestPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsHashCodeTestPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("EqualsHashCodeTestNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsHashCodeTestNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsIncompatibleTypeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsIncompatibleTypeTest.java index 90b8d59c5bc2..0dafe2585310 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsIncompatibleTypeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsIncompatibleTypeTest.java @@ -34,17 +34,17 @@ public class EqualsIncompatibleTypeTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("EqualsIncompatibleTypePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsIncompatibleTypePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("EqualsIncompatibleTypeNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsIncompatibleTypeNegativeCases.java").doTest(); } @Test public void negativeCase_recursive() { - compilationHelper.addSourceFile("EqualsIncompatibleTypeRecursiveTypes.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsIncompatibleTypeRecursiveTypes.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsNaNTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsNaNTest.java index 3d5ddc7d5e9d..53ae6331be8d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsNaNTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsNaNTest.java @@ -32,11 +32,11 @@ public class EqualsNaNTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("EqualsNaNPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsNaNPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("EqualsNaNNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsNaNNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsReferenceTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsReferenceTest.java index 4f827960f0bc..a19651ca060a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/EqualsReferenceTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/EqualsReferenceTest.java @@ -31,11 +31,11 @@ public class EqualsReferenceTest { @Test public void positiveCases() { - compilationTestHelper.addSourceFile("EqualsReferencePositiveCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/EqualsReferencePositiveCases.java").doTest(); } @Test public void negativeCases() { - compilationTestHelper.addSourceFile("EqualsReferenceNegativeCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/EqualsReferenceNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ErroneousThreadPoolConstructorCheckerTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ErroneousThreadPoolConstructorCheckerTest.java index 2d5ba47b0144..0a42e6047756 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ErroneousThreadPoolConstructorCheckerTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ErroneousThreadPoolConstructorCheckerTest.java @@ -36,14 +36,14 @@ public class ErroneousThreadPoolConstructorCheckerTest { @Test public void positiveCases() { compilationHelper - .addSourceFile("ErroneousThreadPoolConstructorCheckerPositiveCases.java") + .addSourceFile("testdata/ErroneousThreadPoolConstructorCheckerPositiveCases.java") .doTest(); } @Test public void negativeCases() { compilationHelper - .addSourceFile("ErroneousThreadPoolConstructorCheckerNegativeCases.java") + .addSourceFile("testdata/ErroneousThreadPoolConstructorCheckerNegativeCases.java") .doTest(); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FallThroughTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FallThroughTest.java index a638152fe926..d6d06a3a89af 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FallThroughTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FallThroughTest.java @@ -33,12 +33,12 @@ public class FallThroughTest { @Test public void positive() { - testHelper.addSourceFile("FallThroughPositiveCases.java").doTest(); + testHelper.addSourceFile("testdata/FallThroughPositiveCases.java").doTest(); } @Test public void negative() { - testHelper.addSourceFile("FallThroughNegativeCases.java").doTest(); + testHelper.addSourceFile("testdata/FallThroughNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java index 08b320156158..4ebde3e5fb6a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java @@ -32,22 +32,22 @@ public class FinallyTest { @Test public void positiveCase1() { - compilationHelper.addSourceFile("FinallyPositiveCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/FinallyPositiveCase1.java").doTest(); } @Test public void positiveCase2() { - compilationHelper.addSourceFile("FinallyPositiveCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/FinallyPositiveCase2.java").doTest(); } @Test public void negativeCase1() { - compilationHelper.addSourceFile("FinallyNegativeCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/FinallyNegativeCase1.java").doTest(); } @Test public void negativeCase2() { - compilationHelper.addSourceFile("FinallyNegativeCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/FinallyNegativeCase2.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FloatingPointAssertionWithinEpsilonTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FloatingPointAssertionWithinEpsilonTest.java index 5f20fc35e24b..a2013289e38f 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FloatingPointAssertionWithinEpsilonTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FloatingPointAssertionWithinEpsilonTest.java @@ -36,14 +36,14 @@ public final class FloatingPointAssertionWithinEpsilonTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("FloatingPointAssertionWithinEpsilonPositiveCases.java") + .addSourceFile("testdata/FloatingPointAssertionWithinEpsilonPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("FloatingPointAssertionWithinEpsilonNegativeCases.java") + .addSourceFile("testdata/FloatingPointAssertionWithinEpsilonNegativeCases.java") .doTest(); } @@ -51,8 +51,8 @@ public void negativeCase() { public void fixes() { BugCheckerRefactoringTestHelper.newInstance( FloatingPointAssertionWithinEpsilon.class, getClass()) - .addInput("FloatingPointAssertionWithinEpsilonPositiveCases.java") - .addOutput("FloatingPointAssertionWithinEpsilonPositiveCases_expected.java") + .addInput("testdata/FloatingPointAssertionWithinEpsilonPositiveCases.java") + .addOutput("testdata/FloatingPointAssertionWithinEpsilonPositiveCases_expected.java") .doTest(TestMode.AST_MATCH); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FunctionalInterfaceMethodChangedTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FunctionalInterfaceMethodChangedTest.java index 1045ca987a4b..4db70ebb6d9b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FunctionalInterfaceMethodChangedTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FunctionalInterfaceMethodChangedTest.java @@ -32,11 +32,15 @@ public class FunctionalInterfaceMethodChangedTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("FunctionalInterfaceMethodChangedPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/FunctionalInterfaceMethodChangedPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("FunctionalInterfaceMethodChangedNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/FunctionalInterfaceMethodChangedNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FutureReturnValueIgnoredTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FutureReturnValueIgnoredTest.java index 49e31443d01d..64d9fd244372 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FutureReturnValueIgnoredTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FutureReturnValueIgnoredTest.java @@ -32,12 +32,12 @@ public class FutureReturnValueIgnoredTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("FutureReturnValueIgnoredPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/FutureReturnValueIgnoredPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("FutureReturnValueIgnoredNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/FutureReturnValueIgnoredNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionTypeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionTypeTest.java index ab2155c00795..8ac7c995d752 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionTypeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionTypeTest.java @@ -28,14 +28,14 @@ public class FuturesGetCheckedIllegalExceptionTypeTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("FuturesGetCheckedIllegalExceptionTypePositiveCases.java") + .addSourceFile("testdata/FuturesGetCheckedIllegalExceptionTypePositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("FuturesGetCheckedIllegalExceptionTypeNegativeCases.java") + .addSourceFile("testdata/FuturesGetCheckedIllegalExceptionTypeNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FuzzyEqualsShouldNotBeUsedInEqualsMethodTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FuzzyEqualsShouldNotBeUsedInEqualsMethodTest.java index 4fdc08329fef..0e2dd7541202 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FuzzyEqualsShouldNotBeUsedInEqualsMethodTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FuzzyEqualsShouldNotBeUsedInEqualsMethodTest.java @@ -32,14 +32,14 @@ public class FuzzyEqualsShouldNotBeUsedInEqualsMethodTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("FuzzyEqualsShouldNotBeUsedInEqualsMethodPositiveCases.java") + .addSourceFile("testdata/FuzzyEqualsShouldNotBeUsedInEqualsMethodPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("FuzzyEqualsShouldNotBeUsedInEqualsMethodNegativeCases.java") + .addSourceFile("testdata/FuzzyEqualsShouldNotBeUsedInEqualsMethodNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/GetClassOnClassTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/GetClassOnClassTest.java index eba74eef3a65..ebc45837c597 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/GetClassOnClassTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/GetClassOnClassTest.java @@ -32,11 +32,11 @@ public class GetClassOnClassTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("GetClassOnClassPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/GetClassOnClassPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("GetClassOnClassNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/GetClassOnClassNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/HidingFieldTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/HidingFieldTest.java index a1dd643a0487..7fc05ff890a3 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/HidingFieldTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/HidingFieldTest.java @@ -37,13 +37,13 @@ public void setUp() { @Test public void hidingFieldPositiveCases() { compilationHelper - .addSourceFile("HidingFieldPositiveCases1.java") - .addSourceFile("HidingFieldPositiveCases2.java") + .addSourceFile("testdata/HidingFieldPositiveCases1.java") + .addSourceFile("testdata/HidingFieldPositiveCases2.java") .doTest(); } @Test public void hidingFieldNegativeCases() { - compilationHelper.addSourceFile("HidingFieldNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/HidingFieldNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChainingTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChainingTest.java index 6770dd647d06..65ac37be1ae7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChainingTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChainingTest.java @@ -31,11 +31,15 @@ public class ImplementAssertionWithChainingTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ImplementAssertionWithChainingPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ImplementAssertionWithChainingPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ImplementAssertionWithChainingNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ImplementAssertionWithChainingNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/InconsistentCapitalizationTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/InconsistentCapitalizationTest.java index be7d97b97c4a..10632ce9b86e 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/InconsistentCapitalizationTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/InconsistentCapitalizationTest.java @@ -33,7 +33,9 @@ public class InconsistentCapitalizationTest { @Test public void negativeCases() { - compilationHelper.addSourceFile("InconsistentCapitalizationNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentCapitalizationNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/IncrementInForLoopAndHeaderTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/IncrementInForLoopAndHeaderTest.java index e6cddc52a8d6..d1f421e38128 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/IncrementInForLoopAndHeaderTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/IncrementInForLoopAndHeaderTest.java @@ -36,11 +36,15 @@ public void setup() { @Test public void positiveCases() { - compilationTestHelper.addSourceFile("IncrementInForLoopAndHeaderPositiveCases.java").doTest(); + compilationTestHelper + .addSourceFile("testdata/IncrementInForLoopAndHeaderPositiveCases.java") + .doTest(); } @Test public void negativeCases() { - compilationTestHelper.addSourceFile("IncrementInForLoopAndHeaderNegativeCases.java").doTest(); + compilationTestHelper + .addSourceFile("testdata/IncrementInForLoopAndHeaderNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/InsecureCipherModeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/InsecureCipherModeTest.java index cedbb572e314..603af4e544a1 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/InsecureCipherModeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/InsecureCipherModeTest.java @@ -31,11 +31,11 @@ public class InsecureCipherModeTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("InsecureCipherModePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/InsecureCipherModePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("InsecureCipherModeNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/InsecureCipherModeNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/InstanceOfAndCastMatchWrongTypeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/InstanceOfAndCastMatchWrongTypeTest.java index 047e18e085b0..2dc7f800143b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/InstanceOfAndCastMatchWrongTypeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/InstanceOfAndCastMatchWrongTypeTest.java @@ -31,12 +31,16 @@ public class InstanceOfAndCastMatchWrongTypeTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("InstanceOfAndCastMatchWrongTypePositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/InstanceOfAndCastMatchWrongTypePositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("InstanceOfAndCastMatchWrongTypeNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/InstanceOfAndCastMatchWrongTypeNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/InvalidPatternSyntaxTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/InvalidPatternSyntaxTest.java index cc7dd8744d43..1bd97d3656d3 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/InvalidPatternSyntaxTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/InvalidPatternSyntaxTest.java @@ -32,11 +32,11 @@ public class InvalidPatternSyntaxTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("InvalidPatternSyntaxPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/InvalidPatternSyntaxPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("InvalidPatternSyntaxNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/InvalidPatternSyntaxNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/IterableAndIteratorTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/IterableAndIteratorTest.java index c48534a9d916..e116fca11527 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/IterableAndIteratorTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/IterableAndIteratorTest.java @@ -30,11 +30,11 @@ public class IterableAndIteratorTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("IterableAndIteratorPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/IterableAndIteratorPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("IterableAndIteratorNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/IterableAndIteratorNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit3TestNotRunTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit3TestNotRunTest.java index 6ac5b80e2deb..4308f5652d2d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit3TestNotRunTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit3TestNotRunTest.java @@ -35,7 +35,7 @@ public class JUnit3TestNotRunTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("JUnit3TestNotRunPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit3TestNotRunPositiveCases.java").doTest(); } @Test @@ -312,29 +312,29 @@ public void testDoesStuff() {} @Test public void negativeCase1() { - compilationHelper.addSourceFile("JUnit3TestNotRunNegativeCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit3TestNotRunNegativeCase1.java").doTest(); } @Test public void negativeCase2() { - compilationHelper.addSourceFile("JUnit3TestNotRunNegativeCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit3TestNotRunNegativeCase2.java").doTest(); } @Test public void negativeCase3() { - compilationHelper.addSourceFile("JUnit3TestNotRunNegativeCase3.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit3TestNotRunNegativeCase3.java").doTest(); } @Test public void negativeCase4() { - compilationHelper.addSourceFile("JUnit3TestNotRunNegativeCase4.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit3TestNotRunNegativeCase4.java").doTest(); } @Test public void negativeCase5() { compilationHelper - .addSourceFile("JUnit3TestNotRunNegativeCase3.java") // needed as a dependency - .addSourceFile("JUnit3TestNotRunNegativeCase5.java") + .addSourceFile("testdata/JUnit3TestNotRunNegativeCase3.java") // needed as a dependency + .addSourceFile("testdata/JUnit3TestNotRunNegativeCase5.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4SetUpNotRunTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4SetUpNotRunTest.java index 66610ba515f0..a3ab6914988a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4SetUpNotRunTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4SetUpNotRunTest.java @@ -38,12 +38,14 @@ public class JUnit4SetUpNotRunTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("JUnit4SetUpNotRunPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4SetUpNotRunPositiveCases.java").doTest(); } @Test public void positiveCase_customBefore() { - compilationHelper.addSourceFile("JUnit4SetUpNotRunPositiveCaseCustomBefore.java").doTest(); + compilationHelper + .addSourceFile("testdata/JUnit4SetUpNotRunPositiveCaseCustomBefore.java") + .doTest(); } @Test @@ -87,12 +89,14 @@ public void badVisibility() {} @Test public void positiveCase_customBeforeDifferentName() { - compilationHelper.addSourceFile("JUnit4SetUpNotRunPositiveCaseCustomBefore2.java").doTest(); + compilationHelper + .addSourceFile("testdata/JUnit4SetUpNotRunPositiveCaseCustomBefore2.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("JUnit4SetUpNotRunNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4SetUpNotRunNegativeCases.java").doTest(); } public abstract static class SuperTest { diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TearDownNotRunTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TearDownNotRunTest.java index e8bec5f0f36d..7504f217de4b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TearDownNotRunTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TearDownNotRunTest.java @@ -32,21 +32,25 @@ public class JUnit4TearDownNotRunTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("JUnit4TearDownNotRunPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TearDownNotRunPositiveCases.java").doTest(); } @Test public void positiveCase_customAnnotation() { - compilationHelper.addSourceFile("JUnit4TearDownNotRunPositiveCaseCustomAfter.java").doTest(); + compilationHelper + .addSourceFile("testdata/JUnit4TearDownNotRunPositiveCaseCustomAfter.java") + .doTest(); } @Test public void positiveCase_customAnnotationDifferentName() { - compilationHelper.addSourceFile("JUnit4TearDownNotRunPositiveCaseCustomAfter2.java").doTest(); + compilationHelper + .addSourceFile("testdata/JUnit4TearDownNotRunPositiveCaseCustomAfter2.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("JUnit4TearDownNotRunNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TearDownNotRunNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TestNotRunTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TestNotRunTest.java index 1438194db484..3758cca49c7c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TestNotRunTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/JUnit4TestNotRunTest.java @@ -37,12 +37,12 @@ public class JUnit4TestNotRunTest { @Test public void positiveCase1() { - compilationHelper.addSourceFile("JUnit4TestNotRunPositiveCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TestNotRunPositiveCase1.java").doTest(); } @Test public void positiveCase2() { - compilationHelper.addSourceFile("JUnit4TestNotRunPositiveCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TestNotRunPositiveCase2.java").doTest(); } @Test @@ -598,29 +598,29 @@ public void foo() {} @Test public void negativeCase1() { - compilationHelper.addSourceFile("JUnit4TestNotRunNegativeCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TestNotRunNegativeCase1.java").doTest(); } @Test public void negativeCase2() { - compilationHelper.addSourceFile("JUnit4TestNotRunNegativeCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TestNotRunNegativeCase2.java").doTest(); } @Test public void negativeCase3() { - compilationHelper.addSourceFile("JUnit4TestNotRunNegativeCase3.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TestNotRunNegativeCase3.java").doTest(); } @Test public void negativeCase4() { - compilationHelper.addSourceFile("JUnit4TestNotRunNegativeCase4.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnit4TestNotRunNegativeCase4.java").doTest(); } @Test public void negativeCase5() { compilationHelper - .addSourceFile("JUnit4TestNotRunBaseClass.java") - .addSourceFile("JUnit4TestNotRunNegativeCase5.java") + .addSourceFile("testdata/JUnit4TestNotRunBaseClass.java") + .addSourceFile("testdata/JUnit4TestNotRunNegativeCase5.java") .doTest(); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/JUnitAssertSameCheckTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/JUnitAssertSameCheckTest.java index e094a2f57e34..c50831b1d2e6 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/JUnitAssertSameCheckTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/JUnitAssertSameCheckTest.java @@ -38,11 +38,11 @@ public void setUp() { @Test public void positiveCase() { - compilationHelper.addSourceFile("JUnitAssertSameCheckPositiveCase.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnitAssertSameCheckPositiveCase.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("JUnitAssertSameCheckNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JUnitAssertSameCheckNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/JUnitParameterMethodNotFoundTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/JUnitParameterMethodNotFoundTest.java index 9c7671b60f1d..d1043970adba 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/JUnitParameterMethodNotFoundTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/JUnitParameterMethodNotFoundTest.java @@ -29,26 +29,30 @@ public class JUnitParameterMethodNotFoundTest { @Test public void negativeCase_noErrorsFound() { - compilationHelper.addSourceFile("JUnitParameterMethodNotFoundNegativeCase.java").doTest(); + compilationHelper + .addSourceFile("testdata/JUnitParameterMethodNotFoundNegativeCase.java") + .doTest(); } @Test public void negativeCase_nonJUnitParamsRunner_noErrorsFound() { compilationHelper - .addSourceFile("JUnitParameterMethodNotFoundNegativeCaseNonJUnitParamsRunner.java") + .addSourceFile("testdata/JUnitParameterMethodNotFoundNegativeCaseNonJUnitParamsRunner.java") .doTest(); } @Test public void negativeCase_inheritedMethods_noErrorsFound() { compilationHelper - .addSourceFile("JUnitParameterMethodNotFoundNegativeCaseBaseClass.java") - .addSourceFile("JUnitParameterMethodNotFoundNegativeCaseSuperClass.java") + .addSourceFile("testdata/JUnitParameterMethodNotFoundNegativeCaseBaseClass.java") + .addSourceFile("testdata/JUnitParameterMethodNotFoundNegativeCaseSuperClass.java") .doTest(); } @Test public void positiveCase_errorReported() { - compilationHelper.addSourceFile("JUnitParameterMethodNotFoundPositiveCase.java").doTest(); + compilationHelper + .addSourceFile("testdata/JUnitParameterMethodNotFoundPositiveCase.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/LambdaFunctionalInterfaceTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/LambdaFunctionalInterfaceTest.java index c55467fb78cb..54ceb4d6c232 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/LambdaFunctionalInterfaceTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/LambdaFunctionalInterfaceTest.java @@ -34,12 +34,16 @@ public class LambdaFunctionalInterfaceTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("LambdaFunctionalInterfacePositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/LambdaFunctionalInterfacePositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("LambdaFunctionalInterfaceNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/LambdaFunctionalInterfaceNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/LockOnNonEnclosingClassLiteralTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/LockOnNonEnclosingClassLiteralTest.java index e70b7f567063..5ed1787e1a81 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/LockOnNonEnclosingClassLiteralTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/LockOnNonEnclosingClassLiteralTest.java @@ -29,11 +29,15 @@ public final class LockOnNonEnclosingClassLiteralTest { @Test public void lockOnNonEnclosingClassLiteralPositiveCases() { - compilationHelper.addSourceFile("LockOnNonEnclosingClassLiteralPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/LockOnNonEnclosingClassLiteralPositiveCases.java") + .doTest(); } @Test public void lockOnNonEnclosingClassLiteralNegativeCases() { - compilationHelper.addSourceFile("LockOnNonEnclosingClassLiteralNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/LockOnNonEnclosingClassLiteralNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/LongLiteralLowerCaseSuffixTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/LongLiteralLowerCaseSuffixTest.java index 7c5c833cfc74..5f613ddfe853 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/LongLiteralLowerCaseSuffixTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/LongLiteralLowerCaseSuffixTest.java @@ -35,18 +35,24 @@ public class LongLiteralLowerCaseSuffixTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("LongLiteralLowerCaseSuffixPositiveCase1.java").doTest(); + compilationHelper + .addSourceFile("testdata/LongLiteralLowerCaseSuffixPositiveCase1.java") + .doTest(); } /** Test for Java 7 integer literals that include underscores. */ @Test public void java7PositiveCase() { - compilationHelper.addSourceFile("LongLiteralLowerCaseSuffixPositiveCase2.java").doTest(); + compilationHelper + .addSourceFile("testdata/LongLiteralLowerCaseSuffixPositiveCase2.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("LongLiteralLowerCaseSuffixNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/LongLiteralLowerCaseSuffixNegativeCases.java") + .doTest(); } @Test @@ -54,7 +60,7 @@ public void disableable() { compilationHelper .setArgs(ImmutableList.of("-Xep:LongLiteralLowerCaseSuffix:OFF")) .expectNoDiagnostics() - .addSourceFile("LongLiteralLowerCaseSuffixPositiveCase1.java") + .addSourceFile("testdata/LongLiteralLowerCaseSuffixPositiveCase1.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/MissingFailTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/MissingFailTest.java index d7faf936985d..852d6a54e412 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/MissingFailTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/MissingFailTest.java @@ -35,27 +35,27 @@ public class MissingFailTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("MissingFailPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MissingFailPositiveCases.java").doTest(); } @Test public void positiveCases2() { - compilationHelper.addSourceFile("MissingFailPositiveCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/MissingFailPositiveCases2.java").doTest(); } @Test public void positiveCases3() { - compilationHelper.addSourceFile("MissingFailPositiveCases3.java").doTest(); + compilationHelper.addSourceFile("testdata/MissingFailPositiveCases3.java").doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("MissingFailNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MissingFailNegativeCases.java").doTest(); } @Test public void negativeCases2() { - compilationHelper.addSourceFile("MissingFailNegativeCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/MissingFailNegativeCases2.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/MissingTestCallTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/MissingTestCallTest.java index c5a5004348a1..8896bd14de54 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/MissingTestCallTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/MissingTestCallTest.java @@ -53,13 +53,13 @@ void test() { @Test // BUG: Diagnostic contains: void test2(CompilationTestHelper helper) { - helper.addSourceFile("Foo.java"); + helper.addSourceFile("testdata/Foo.java"); } @Test // BUG: Diagnostic contains: void test3(BugCheckerRefactoringTestHelper helper) { - helper.addInput("Foo.java"); + helper.addInput("testdata/Foo.java"); } } """) @@ -86,7 +86,7 @@ void test() { @Test void doesNotMatchIfNotAtEnd() { - helper.addSourceFile("Foo.java"); + helper.addSourceFile("testdata/Foo.java"); hashCode(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/MisusedWeekYearTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/MisusedWeekYearTest.java index 9caf782f9657..0aaa6e16b710 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/MisusedWeekYearTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/MisusedWeekYearTest.java @@ -31,17 +31,17 @@ public class MisusedWeekYearTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("MisusedWeekYearPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MisusedWeekYearPositiveCases.java").doTest(); } @Test public void positiveCases2() { - compilationHelper.addSourceFile("MisusedWeekYearPositiveCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/MisusedWeekYearPositiveCases2.java").doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("MisusedWeekYearNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MisusedWeekYearNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ModifyCollectionInEnhancedForLoopTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ModifyCollectionInEnhancedForLoopTest.java index c1e3496d2eb1..ae441ba9921d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ModifyCollectionInEnhancedForLoopTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ModifyCollectionInEnhancedForLoopTest.java @@ -30,12 +30,16 @@ public class ModifyCollectionInEnhancedForLoopTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ModifyCollectionInEnhancedForLoopPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ModifyCollectionInEnhancedForLoopPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ModifyCollectionInEnhancedForLoopNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ModifyCollectionInEnhancedForLoopNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ModifySourceCollectionInStreamTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ModifySourceCollectionInStreamTest.java index 907546db2eea..dd0a56fa41ba 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ModifySourceCollectionInStreamTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ModifySourceCollectionInStreamTest.java @@ -32,11 +32,15 @@ public class ModifySourceCollectionInStreamTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("ModifySourceCollectionInStreamPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ModifySourceCollectionInStreamPositiveCases.java") + .doTest(); } @Test public void negativeCasse() { - compilationHelper.addSourceFile("ModifySourceCollectionInStreamNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ModifySourceCollectionInStreamNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItselfTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItselfTest.java index 0d4257c59566..b2b5bd958c71 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItselfTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItselfTest.java @@ -32,11 +32,15 @@ public class ModifyingCollectionWithItselfTest { @Test public void positiveCases1() { - compilationHelper.addSourceFile("ModifyingCollectionWithItselfPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ModifyingCollectionWithItselfPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ModifyingCollectionWithItselfNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ModifyingCollectionWithItselfNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/MultipleParallelOrSequentialCallsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/MultipleParallelOrSequentialCallsTest.java index 110faea4252c..5dccc0b40576 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/MultipleParallelOrSequentialCallsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/MultipleParallelOrSequentialCallsTest.java @@ -42,22 +42,22 @@ public void setup() { @Test public void positiveCases() { compilationTestHelper - .addSourceFile("MultipleParallelOrSequentialCallsPositiveCases.java") + .addSourceFile("testdata/MultipleParallelOrSequentialCallsPositiveCases.java") .doTest(); } @Test public void negativeCases() { compilationTestHelper - .addSourceFile("MultipleParallelOrSequentialCallsNegativeCases.java") + .addSourceFile("testdata/MultipleParallelOrSequentialCallsNegativeCases.java") .doTest(); } @Test public void fixes() { BugCheckerRefactoringTestHelper.newInstance(MultipleParallelOrSequentialCalls.class, getClass()) - .addInput("MultipleParallelOrSequentialCallsPositiveCases.java") - .addOutput("MultipleParallelOrSequentialCallsPositiveCases_expected.java") + .addInput("testdata/MultipleParallelOrSequentialCallsPositiveCases.java") + .addOutput("testdata/MultipleParallelOrSequentialCallsPositiveCases_expected.java") .doTest(TestMode.AST_MATCH); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/MultipleUnaryOperatorsInMethodCallTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/MultipleUnaryOperatorsInMethodCallTest.java index 9495df9e6522..ddd654403638 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/MultipleUnaryOperatorsInMethodCallTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/MultipleUnaryOperatorsInMethodCallTest.java @@ -31,14 +31,14 @@ public class MultipleUnaryOperatorsInMethodCallTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("MultipleUnaryOperatorsInMethodCallPositiveCases.java") + .addSourceFile("testdata/MultipleUnaryOperatorsInMethodCallPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("MultipleUnaryOperatorsInMethodCallNegativeCases.java") + .addSourceFile("testdata/MultipleUnaryOperatorsInMethodCallNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/MustBeClosedCheckerTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/MustBeClosedCheckerTest.java index 3af9472a0b7c..36d90088dc8c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/MustBeClosedCheckerTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/MustBeClosedCheckerTest.java @@ -35,19 +35,19 @@ public class MustBeClosedCheckerTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("MustBeClosedCheckerPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MustBeClosedCheckerPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("MustBeClosedCheckerNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MustBeClosedCheckerNegativeCases.java").doTest(); } @Test public void refactoring() { refactoringHelper - .addInput("MustBeClosedCheckerPositiveCases.java") - .addOutput("MustBeClosedCheckerPositiveCases_expected.java") + .addInput("testdata/MustBeClosedCheckerPositiveCases.java") + .addOutput("testdata/MustBeClosedCheckerPositiveCases_expected.java") .allowBreakingChanges() // The fix is best-effort, and some variable names may clash .doTest(); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/NestedInstanceOfConditionsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/NestedInstanceOfConditionsTest.java index 11d64f242817..e355e3cfea97 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/NestedInstanceOfConditionsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/NestedInstanceOfConditionsTest.java @@ -35,12 +35,16 @@ public class NestedInstanceOfConditionsTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("NestedInstanceOfConditionsPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/NestedInstanceOfConditionsPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("NestedInstanceOfConditionsNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/NestedInstanceOfConditionsNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/NoAllocationCheckerTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/NoAllocationCheckerTest.java index 8b81e2541c2b..40b95bdf61f7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/NoAllocationCheckerTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/NoAllocationCheckerTest.java @@ -32,11 +32,11 @@ public class NoAllocationCheckerTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("NoAllocationCheckerPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NoAllocationCheckerPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("NoAllocationCheckerNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NoAllocationCheckerNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdateTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdateTest.java index 444f0d2e5aff..d08c9c606351 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdateTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdateTest.java @@ -30,11 +30,11 @@ public class NonAtomicVolatileUpdateTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("NonAtomicVolatileUpdatePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NonAtomicVolatileUpdatePositiveCases.java").doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("NonAtomicVolatileUpdateNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NonAtomicVolatileUpdateNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/NonRuntimeAnnotationTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/NonRuntimeAnnotationTest.java index 80759f41ba86..8e3078e565cd 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/NonRuntimeAnnotationTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/NonRuntimeAnnotationTest.java @@ -32,11 +32,11 @@ public class NonRuntimeAnnotationTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("NonRuntimeAnnotationPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NonRuntimeAnnotationPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("NonRuntimeAnnotationNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NonRuntimeAnnotationNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ObjectToStringTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ObjectToStringTest.java index 1b5134dc9ca7..b3a3c9f659da 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ObjectToStringTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ObjectToStringTest.java @@ -40,12 +40,12 @@ public class ObjectToStringTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ObjectToStringPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ObjectToStringPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ObjectToStringNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ObjectToStringNegativeCases.java").doTest(); } /** A class that will be missing at compile-time for {@link #testIncompleteClasspath}. */ diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/OptionalNotPresentTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/OptionalNotPresentTest.java index 4277fff00f9b..170c631efa72 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/OptionalNotPresentTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/OptionalNotPresentTest.java @@ -31,12 +31,12 @@ public class OptionalNotPresentTest { @Test public void negativeCases() { - compilationTestHelper.addSourceFile("OptionalNotPresentNegativeCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/OptionalNotPresentNegativeCases.java").doTest(); } @Test public void positiveCases() { - compilationTestHelper.addSourceFile("OptionalNotPresentPositiveCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/OptionalNotPresentPositiveCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/OverrideThrowableToStringTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/OverrideThrowableToStringTest.java index 2da0d0b461f3..b6a894714647 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/OverrideThrowableToStringTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/OverrideThrowableToStringTest.java @@ -32,19 +32,23 @@ public class OverrideThrowableToStringTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("OverrideThrowableToStringPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/OverrideThrowableToStringPositiveCases.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("OverrideThrowableToStringNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/OverrideThrowableToStringNegativeCases.java") + .doTest(); } @Test public void fixes() { BugCheckerRefactoringTestHelper.newInstance(OverrideThrowableToString.class, getClass()) - .addInput("OverrideThrowableToStringPositiveCases.java") - .addOutput("OverrideThrowableToStringPositiveCases_expected.java") + .addInput("testdata/OverrideThrowableToStringPositiveCases.java") + .addOutput("testdata/OverrideThrowableToStringPositiveCases_expected.java") .doTest(TestMode.AST_MATCH); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/OverridesTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/OverridesTest.java index 3b60a8501e85..5dc1a4eb1aaa 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/OverridesTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/OverridesTest.java @@ -31,41 +31,41 @@ public class OverridesTest { @Test public void positiveCase1() { - compilationHelper.addSourceFile("OverridesPositiveCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesPositiveCase1.java").doTest(); } @Test public void positiveCase2() { - compilationHelper.addSourceFile("OverridesPositiveCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesPositiveCase2.java").doTest(); } @Test public void positiveCase3() { - compilationHelper.addSourceFile("OverridesPositiveCase3.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesPositiveCase3.java").doTest(); } @Test public void positiveCase4() { - compilationHelper.addSourceFile("OverridesPositiveCase4.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesPositiveCase4.java").doTest(); } @Test public void positiveCase5() { - compilationHelper.addSourceFile("OverridesPositiveCase5.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesPositiveCase5.java").doTest(); } @Test public void negativeCase1() { - compilationHelper.addSourceFile("OverridesNegativeCase1.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesNegativeCase1.java").doTest(); } @Test public void negativeCase2() { - compilationHelper.addSourceFile("OverridesNegativeCase2.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesNegativeCase2.java").doTest(); } @Test public void negativeCase3() { - compilationHelper.addSourceFile("OverridesNegativeCase3.java").doTest(); + compilationHelper.addSourceFile("testdata/OverridesNegativeCase3.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/PreconditionsInvalidPlaceholderTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/PreconditionsInvalidPlaceholderTest.java index b0005b3e53fe..ee2ed802341f 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/PreconditionsInvalidPlaceholderTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/PreconditionsInvalidPlaceholderTest.java @@ -31,11 +31,15 @@ public class PreconditionsInvalidPlaceholderTest { @Test public void positiveCase1() { - compilationHelper.addSourceFile("PreconditionsInvalidPlaceholderPositiveCase1.java").doTest(); + compilationHelper + .addSourceFile("testdata/PreconditionsInvalidPlaceholderPositiveCase1.java") + .doTest(); } @Test public void negativeCase1() { - compilationHelper.addSourceFile("PreconditionsInvalidPlaceholderNegativeCase1.java").doTest(); + compilationHelper + .addSourceFile("testdata/PreconditionsInvalidPlaceholderNegativeCase1.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethodTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethodTest.java index 60eb42802172..d58c9f2fcfc0 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethodTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethodTest.java @@ -33,14 +33,14 @@ public class PrimitiveArrayPassedToVarargsMethodTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("PrimitiveArrayPassedToVarargsMethodPositiveCases.java") + .addSourceFile("testdata/PrimitiveArrayPassedToVarargsMethodPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("PrimitiveArrayPassedToVarargsMethodNegativeCases.java") + .addSourceFile("testdata/PrimitiveArrayPassedToVarargsMethodNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/PrivateSecurityContractProtoAccessTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/PrivateSecurityContractProtoAccessTest.java index d9c900178d35..95197c994d43 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/PrivateSecurityContractProtoAccessTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/PrivateSecurityContractProtoAccessTest.java @@ -29,14 +29,14 @@ public class PrivateSecurityContractProtoAccessTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("PrivateSecurityContractProtoAccessPositiveCases.java") + .addSourceFile("testdata/PrivateSecurityContractProtoAccessPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("PrivateSecurityContractProtoAccessNegativeCases.java") + .addSourceFile("testdata/PrivateSecurityContractProtoAccessNegativeCases.java") .doTest(); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ProtocolBufferOrdinalTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ProtocolBufferOrdinalTest.java index f31c7befdeba..118a4ba1e8f7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ProtocolBufferOrdinalTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ProtocolBufferOrdinalTest.java @@ -34,11 +34,11 @@ public class ProtocolBufferOrdinalTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ProtocolBufferOrdinalPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ProtocolBufferOrdinalPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ProtocolBufferOrdinalNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ProtocolBufferOrdinalNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/RestrictedApiCheckerTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/RestrictedApiCheckerTest.java index 51ede202d2de..f905f3a12807 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/RestrictedApiCheckerTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/RestrictedApiCheckerTest.java @@ -37,8 +37,8 @@ public RestrictedApiCheckerTest() { protected RestrictedApiCheckerTest(Class checker) { helper = CompilationTestHelper.newInstance(checker, RestrictedApiCheckerTest.class) - .addSourceFile("Allowlist.java") - .addSourceFile("RestrictedApiMethods.java") + .addSourceFile("testdata/Allowlist.java") + .addSourceFile("testdata/RestrictedApiMethods.java") .matchAllDiagnostics(); refactoringTest = BugCheckerRefactoringTestHelper.newInstance(checker, RestrictedApiCheckerTest.class); diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/RethrowReflectiveOperationExceptionAsLinkageErrorTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/RethrowReflectiveOperationExceptionAsLinkageErrorTest.java index bf1bad8fcffc..79f3efde672d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/RethrowReflectiveOperationExceptionAsLinkageErrorTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/RethrowReflectiveOperationExceptionAsLinkageErrorTest.java @@ -31,14 +31,16 @@ public class RethrowReflectiveOperationExceptionAsLinkageErrorTest { @Test public void positive() { testHelper - .addSourceFile("RethrowReflectiveOperationExceptionAsLinkageErrorPositiveCases.java") + .addSourceFile( + "testdata/RethrowReflectiveOperationExceptionAsLinkageErrorPositiveCases.java") .doTest(); } @Test public void negative() { testHelper - .addSourceFile("RethrowReflectiveOperationExceptionAsLinkageErrorNegativeCases.java") + .addSourceFile( + "testdata/RethrowReflectiveOperationExceptionAsLinkageErrorNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ReturnValueIgnoredTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ReturnValueIgnoredTest.java index 24d20d8aa488..ddec11740d68 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ReturnValueIgnoredTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ReturnValueIgnoredTest.java @@ -34,12 +34,12 @@ public class ReturnValueIgnoredTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("ReturnValueIgnoredPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ReturnValueIgnoredPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ReturnValueIgnoredNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ReturnValueIgnoredNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/RxReturnValueIgnoredTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/RxReturnValueIgnoredTest.java index 0c215405ecd0..b2e3a426ad8c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/RxReturnValueIgnoredTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/RxReturnValueIgnoredTest.java @@ -98,12 +98,12 @@ public class Flowable {} @Test public void positiveCases() { - compilationHelper.addSourceFile("RxReturnValueIgnoredPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/RxReturnValueIgnoredPositiveCases.java").doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("RxReturnValueIgnoredNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/RxReturnValueIgnoredNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssertionTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssertionTest.java index 23a67870d7dc..5ee241631d5a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssertionTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssertionTest.java @@ -38,12 +38,12 @@ public void setUp() { @Test public void positiveCase() { - compilationHelper.addSourceFile("SelfAssertionPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfAssertionPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("SelfAssertionNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfAssertionNegativeCases.java").doTest(); } // regression test for b/32107126 diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssignmentTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssignmentTest.java index b7c8fed62926..967023e1854f 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssignmentTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/SelfAssignmentTest.java @@ -32,16 +32,16 @@ public class SelfAssignmentTest { @Test public void positiveCases1() { - compilationHelper.addSourceFile("SelfAssignmentPositiveCases1.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfAssignmentPositiveCases1.java").doTest(); } @Test public void positiveCases2() { - compilationHelper.addSourceFile("SelfAssignmentPositiveCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfAssignmentPositiveCases2.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("SelfAssignmentNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfAssignmentNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/SelfComparisonTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/SelfComparisonTest.java index f91746f6f707..231e19573600 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/SelfComparisonTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/SelfComparisonTest.java @@ -38,11 +38,11 @@ public void setUp() { @Test public void positiveCase() { - compilationHelper.addSourceFile("SelfComparisonPositiveCase.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfComparisonPositiveCase.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("SelfComparisonNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfComparisonNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/SelfEqualsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/SelfEqualsTest.java index 68e84031ee3b..ba963bac7a70 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/SelfEqualsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/SelfEqualsTest.java @@ -38,12 +38,12 @@ public void setUp() { @Test public void positiveCase() { - compilationHelper.addSourceFile("SelfEqualsPositiveCase.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfEqualsPositiveCase.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("SelfEqualsNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfEqualsNegativeCases.java").doTest(); } @Test @@ -66,12 +66,12 @@ boolean f() { @Test public void positiveCase_guava() { - compilationHelper.addSourceFile("SelfEqualsGuavaPositiveCase.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfEqualsGuavaPositiveCase.java").doTest(); } @Test public void negativeCase_guava() { - compilationHelper.addSourceFile("SelfEqualsGuavaNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SelfEqualsGuavaNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ShouldHaveEvenArgsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ShouldHaveEvenArgsTest.java index 829cd685f540..4566c5c8a708 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ShouldHaveEvenArgsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ShouldHaveEvenArgsTest.java @@ -38,23 +38,27 @@ public void setUp() { @Test public void positiveCase() { - compilationHelper.addSourceFile("ShouldHaveEvenArgsPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ShouldHaveEvenArgsPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ShouldHaveEvenArgsNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ShouldHaveEvenArgsNegativeCases.java").doTest(); } @org.junit.Ignore("Public truth doesn't contain this method") @Test public void positiveCase_multimap() { - compilationHelper.addSourceFile("ShouldHaveEvenArgsMultimapPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ShouldHaveEvenArgsMultimapPositiveCases.java") + .doTest(); } @org.junit.Ignore("Public truth doesn't contain this method") @Test public void negativeCase_multimap() { - compilationHelper.addSourceFile("ShouldHaveEvenArgsMultimapNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ShouldHaveEvenArgsMultimapNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/SizeGreaterThanOrEqualsZeroTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/SizeGreaterThanOrEqualsZeroTest.java index 2422b7eac14d..e7652f6a8b3b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/SizeGreaterThanOrEqualsZeroTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/SizeGreaterThanOrEqualsZeroTest.java @@ -37,11 +37,15 @@ public void setUp() { @Test public void collectionSizePositiveCases() { - compilationHelper.addSourceFile("SizeGreaterThanOrEqualsZeroPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/SizeGreaterThanOrEqualsZeroPositiveCases.java") + .doTest(); } @Test public void collectionSizeNegativeCases() { - compilationHelper.addSourceFile("SizeGreaterThanOrEqualsZeroNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/SizeGreaterThanOrEqualsZeroNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/StaticQualifiedUsingExpressionTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/StaticQualifiedUsingExpressionTest.java index 6f800cf72f70..d0d8a0a1f8dd 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/StaticQualifiedUsingExpressionTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/StaticQualifiedUsingExpressionTest.java @@ -35,17 +35,23 @@ public class StaticQualifiedUsingExpressionTest { @Test public void positiveCase1() { - compilationHelper.addSourceFile("StaticQualifiedUsingExpressionPositiveCase1.java").doTest(); + compilationHelper + .addSourceFile("testdata/StaticQualifiedUsingExpressionPositiveCase1.java") + .doTest(); } @Test public void positiveCase2() { - compilationHelper.addSourceFile("StaticQualifiedUsingExpressionPositiveCase2.java").doTest(); + compilationHelper + .addSourceFile("testdata/StaticQualifiedUsingExpressionPositiveCase2.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("StaticQualifiedUsingExpressionNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/StaticQualifiedUsingExpressionNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/StringBuilderInitWithCharTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/StringBuilderInitWithCharTest.java index d0f3b1c4bcee..9d17b8827d89 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/StringBuilderInitWithCharTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/StringBuilderInitWithCharTest.java @@ -32,11 +32,15 @@ public class StringBuilderInitWithCharTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("StringBuilderInitWithCharPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/StringBuilderInitWithCharPositiveCases.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("StringBuilderInitWithCharNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/StringBuilderInitWithCharNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/StringSplitterTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/StringSplitterTest.java index 958dc49983bc..8e33effc6aff 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/StringSplitterTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/StringSplitterTest.java @@ -479,14 +479,14 @@ void f() { @Test public void stringSplitPositive() { CompilationTestHelper.newInstance(StringSplitter.class, getClass()) - .addSourceFile("StringSplitterPositiveCases.java") + .addSourceFile("testdata/StringSplitterPositiveCases.java") .doTest(); } @Test public void stringSplitNegative() { CompilationTestHelper.newInstance(StringSplitter.class, getClass()) - .addSourceFile("StringSplitterNegativeCases.java") + .addSourceFile("testdata/StringSplitterNegativeCases.java") .doTest(); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/SuppressWarningsDeprecatedTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/SuppressWarningsDeprecatedTest.java index ec786cd406af..b330421ca0e7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/SuppressWarningsDeprecatedTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/SuppressWarningsDeprecatedTest.java @@ -34,11 +34,15 @@ public class SuppressWarningsDeprecatedTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("SuppressWarningsDeprecatedPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/SuppressWarningsDeprecatedPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("SuppressWarningsDeprecatedNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/SuppressWarningsDeprecatedNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/SwigMemoryLeakTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/SwigMemoryLeakTest.java index 31408e0cbb44..05871a2734e7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/SwigMemoryLeakTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/SwigMemoryLeakTest.java @@ -32,11 +32,11 @@ public class SwigMemoryLeakTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("SwigMemoryLeakPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SwigMemoryLeakPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("SwigMemoryLeakNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/SwigMemoryLeakNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ThreadJoinLoopTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ThreadJoinLoopTest.java index 9cd5c19fa9ae..ce5b230b2162 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ThreadJoinLoopTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ThreadJoinLoopTest.java @@ -38,19 +38,19 @@ public void setup() { @Test public void positiveCases() { - compilationTestHelper.addSourceFile("ThreadJoinLoopPositiveCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/ThreadJoinLoopPositiveCases.java").doTest(); } @Test public void negativeCases() { - compilationTestHelper.addSourceFile("ThreadJoinLoopNegativeCases.java").doTest(); + compilationTestHelper.addSourceFile("testdata/ThreadJoinLoopNegativeCases.java").doTest(); } @Test public void fixes() { BugCheckerRefactoringTestHelper.newInstance(ThreadJoinLoop.class, getClass()) - .addInput("ThreadJoinLoopPositiveCases.java") - .addOutput("ThreadJoinLoopPositiveCases_expected.java") + .addInput("testdata/ThreadJoinLoopPositiveCases.java") + .addOutput("testdata/ThreadJoinLoopPositiveCases_expected.java") .doTest(TestMode.AST_MATCH); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ThrowIfUncheckedKnownCheckedTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ThrowIfUncheckedKnownCheckedTest.java index c06f6703d6f6..0bcdc7212b3b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ThrowIfUncheckedKnownCheckedTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ThrowIfUncheckedKnownCheckedTest.java @@ -29,11 +29,15 @@ public class ThrowIfUncheckedKnownCheckedTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ThrowIfUncheckedKnownCheckedTestPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ThrowIfUncheckedKnownCheckedTestPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ThrowIfUncheckedKnownCheckedTestNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ThrowIfUncheckedKnownCheckedTestNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/ThrowsUncheckedExceptionTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/ThrowsUncheckedExceptionTest.java index 36169d1ff470..7a5708d5ae69 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/ThrowsUncheckedExceptionTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/ThrowsUncheckedExceptionTest.java @@ -33,12 +33,12 @@ public final class ThrowsUncheckedExceptionTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ThrowsUncheckedExceptionPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ThrowsUncheckedExceptionPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ThrowsUncheckedExceptionNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ThrowsUncheckedExceptionNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/TreeToStringTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/TreeToStringTest.java index e2c7ac11d8ad..681a1e434695 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/TreeToStringTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/TreeToStringTest.java @@ -108,13 +108,13 @@ private String createTree(VisitorState state) { @Test public void positiveCases() { - testHelper.addSourceFile("TreeToStringPositiveCases.java").doTest(); + testHelper.addSourceFile("testdata/TreeToStringPositiveCases.java").doTest(); } @Test public void negativeCases() { testHelper - .addSourceFile("TreeToStringNegativeCases.java") + .addSourceFile("testdata/TreeToStringNegativeCases.java") .addModules( "jdk.compiler/com.sun.tools.javac.code", "jdk.compiler/com.sun.tools.javac.util") .doTest(); diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/TruthAssertExpectedTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/TruthAssertExpectedTest.java index e44e276716a9..af76c7d1a5e3 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/TruthAssertExpectedTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/TruthAssertExpectedTest.java @@ -33,11 +33,11 @@ public final class TruthAssertExpectedTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("TruthAssertExpectedPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TruthAssertExpectedPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("TruthAssertExpectedNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TruthAssertExpectedNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/TruthConstantAssertsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/TruthConstantAssertsTest.java index 1e5eb69fd998..4e963bc0dddc 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/TruthConstantAssertsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/TruthConstantAssertsTest.java @@ -38,11 +38,11 @@ public void setUp() { @Test public void positiveCase() { - compilationHelper.addSourceFile("TruthConstantAssertsPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TruthConstantAssertsPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("TruthConstantAssertsNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TruthConstantAssertsNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/TryFailThrowableTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/TryFailThrowableTest.java index 46b51a5b82e7..effcbfdc0d0c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/TryFailThrowableTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/TryFailThrowableTest.java @@ -31,11 +31,11 @@ public class TryFailThrowableTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("TryFailThrowablePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TryFailThrowablePositiveCases.java").doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("TryFailThrowableNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TryFailThrowableNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/URLEqualsHashCodeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/URLEqualsHashCodeTest.java index 71f2f941e7b8..f4b1cb3e064b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/URLEqualsHashCodeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/URLEqualsHashCodeTest.java @@ -38,11 +38,11 @@ public void setUp() { @Test public void positiveCase() { - compilationHelper.addSourceFile("URLEqualsHashCodePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/URLEqualsHashCodePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("URLEqualsHashCodeNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/URLEqualsHashCodeNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/UngroupedOverloadsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/UngroupedOverloadsTest.java index 3b842f94408c..5d02a9e1ecb2 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/UngroupedOverloadsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/UngroupedOverloadsTest.java @@ -41,58 +41,64 @@ public final class UngroupedOverloadsTest { @Test public void ungroupedOverloadsPositiveCasesSingle() { - compilationHelper.addSourceFile("UngroupedOverloadsPositiveCasesSingle.java").doTest(); + compilationHelper.addSourceFile("testdata/UngroupedOverloadsPositiveCasesSingle.java").doTest(); } @Test public void ungroupedOverloadsPositiveCasesMultiple() { - compilationHelper.addSourceFile("UngroupedOverloadsPositiveCasesMultiple.java").doTest(); + compilationHelper + .addSourceFile("testdata/UngroupedOverloadsPositiveCasesMultiple.java") + .doTest(); } @Test public void ungroupedOverloadsPositiveCasesInterleaved() { - compilationHelper.addSourceFile("UngroupedOverloadsPositiveCasesInterleaved.java").doTest(); + compilationHelper + .addSourceFile("testdata/UngroupedOverloadsPositiveCasesInterleaved.java") + .doTest(); } @Test public void ungroupedOverloadsPositiveCasesCovering() { - compilationHelper.addSourceFile("UngroupedOverloadsPositiveCasesCovering.java").doTest(); + compilationHelper + .addSourceFile("testdata/UngroupedOverloadsPositiveCasesCovering.java") + .doTest(); } @Test public void ungroupedOverloadsPositiveCasesCoveringOnlyFirstOverload() { compilationHelper - .addSourceFile("UngroupedOverloadsPositiveCasesCoveringOnlyOnFirst.java") + .addSourceFile("testdata/UngroupedOverloadsPositiveCasesCoveringOnlyOnFirst.java") .setArgs(ImmutableList.of("-XepOpt:UngroupedOverloads:BatchFindings")) .doTest(); } @Test public void ungroupedOverloadsNegativeCases() { - compilationHelper.addSourceFile("UngroupedOverloadsNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/UngroupedOverloadsNegativeCases.java").doTest(); } @Test public void ungroupedOverloadsRefactoringComments() { refactoringHelper - .addInput("UngroupedOverloadsRefactoringComments.java") - .addOutput("UngroupedOverloadsRefactoringComments_expected.java") + .addInput("testdata/UngroupedOverloadsRefactoringComments.java") + .addOutput("testdata/UngroupedOverloadsRefactoringComments_expected.java") .doTest(); } @Test public void ungroupedOverloadsRefactoringMultiple() { refactoringHelper - .addInput("UngroupedOverloadsRefactoringMultiple.java") - .addOutput("UngroupedOverloadsRefactoringMultiple_expected.java") + .addInput("testdata/UngroupedOverloadsRefactoringMultiple.java") + .addOutput("testdata/UngroupedOverloadsRefactoringMultiple_expected.java") .doTest(); } @Test public void ungroupedOverloadsRefactoringInterleaved() { refactoringHelper - .addInput("UngroupedOverloadsRefactoringInterleaved.java") - .addOutput("UngroupedOverloadsRefactoringInterleaved_expected.java") + .addInput("testdata/UngroupedOverloadsRefactoringInterleaved.java") + .addOutput("testdata/UngroupedOverloadsRefactoringInterleaved_expected.java") .doTest(); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/UnnecessaryLongToIntConversionTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/UnnecessaryLongToIntConversionTest.java index 98e0d95da4f2..07bda2df9331 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/UnnecessaryLongToIntConversionTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/UnnecessaryLongToIntConversionTest.java @@ -38,12 +38,16 @@ public class UnnecessaryLongToIntConversionTest { @Test public void longParameterLongToIntPositiveCases() { - compilationHelper.addSourceFile("UnnecessaryLongToIntConversionPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/UnnecessaryLongToIntConversionPositiveCases.java") + .doTest(); } @Test public void longParameterLongToIntNegativeCases() { - compilationHelper.addSourceFile("UnnecessaryLongToIntConversionNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/UnnecessaryLongToIntConversionNegativeCases.java") + .doTest(); } // Test the suggested fixes, first removing the conversion and second replacing it with a call to diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/UnsafeReflectiveConstructionCastTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/UnsafeReflectiveConstructionCastTest.java index 4112f9bd1b74..256ef96bcef4 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/UnsafeReflectiveConstructionCastTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/UnsafeReflectiveConstructionCastTest.java @@ -142,6 +142,8 @@ private Fn newInstanceOnGetDeclaredConstructorChained() throws Exception { @Test public void negativeCase() { - compilationHelper.addSourceFile("UnsafeReflectiveConstructionCastNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/UnsafeReflectiveConstructionCastNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/WaitNotInLoopTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/WaitNotInLoopTest.java index c4d98c00e87f..38d9d1eccb0a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/WaitNotInLoopTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/WaitNotInLoopTest.java @@ -32,11 +32,11 @@ public class WaitNotInLoopTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("WaitNotInLoopPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/WaitNotInLoopPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("WaitNotInLoopNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/WaitNotInLoopNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/android/BundleDeserializationCastTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/android/BundleDeserializationCastTest.java index 2bd70631f808..e2a81309041d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/android/BundleDeserializationCastTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/android/BundleDeserializationCastTest.java @@ -126,7 +126,7 @@ void test() { @Test public void negativeCaseGetParcelableList() { compilationHelper - .addSourceFile("CustomParcelableList.java") + .addSourceFile("testdata/CustomParcelableList.java") .addSourceLines( "Test.java", """ diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/android/FragmentNotInstantiableTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/android/FragmentNotInstantiableTest.java index 0e9fe757d165..8f0528c73cda 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/android/FragmentNotInstantiableTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/android/FragmentNotInstantiableTest.java @@ -46,32 +46,32 @@ public CustomFragmentNotInstantiable() { @Test public void positiveCases() { createCompilationTestHelper(FragmentNotInstantiable.class) - .addSourceFile("FragmentNotInstantiablePositiveCases.java") + .addSourceFile("testdata/FragmentNotInstantiablePositiveCases.java") .doTest(); } @Test public void negativeCase() { createCompilationTestHelper(FragmentNotInstantiable.class) - .addSourceFile("FragmentNotInstantiableNegativeCases.java") + .addSourceFile("testdata/FragmentNotInstantiableNegativeCases.java") .doTest(); } @Test public void positiveCases_custom() { createCompilationTestHelper(CustomFragmentNotInstantiable.class) - .addSourceFile("FragmentNotInstantiablePositiveCases.java") - .addSourceFile("CustomFragment.java") - .addSourceFile("CustomFragmentNotInstantiablePositiveCases.java") + .addSourceFile("testdata/FragmentNotInstantiablePositiveCases.java") + .addSourceFile("testdata/CustomFragment.java") + .addSourceFile("testdata/CustomFragmentNotInstantiablePositiveCases.java") .doTest(); } @Test public void negativeCase_custom() { createCompilationTestHelper(CustomFragmentNotInstantiable.class) - .addSourceFile("FragmentNotInstantiableNegativeCases.java") - .addSourceFile("CustomFragment.java") - .addSourceFile("CustomFragmentNotInstantiableNegativeCases.java") + .addSourceFile("testdata/FragmentNotInstantiableNegativeCases.java") + .addSourceFile("testdata/CustomFragment.java") + .addSourceFile("testdata/CustomFragmentNotInstantiableNegativeCases.java") .doTest(); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/android/HardCodedSdCardPathTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/android/HardCodedSdCardPathTest.java index 7fc1d101823a..bf6ebe42f815 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/android/HardCodedSdCardPathTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/android/HardCodedSdCardPathTest.java @@ -34,7 +34,7 @@ public class HardCodedSdCardPathTest { public void matchingCode_onAndroid() { compilationHelper .setArgs(ImmutableList.of("-XDandroidCompatible=true")) - .addSourceFile("HardCodedSdCardPathPositiveCases.java") + .addSourceFile("testdata/HardCodedSdCardPathPositiveCases.java") .doTest(); } @@ -56,7 +56,7 @@ public class HardCodedSdCardPathMatchingCode { public void negativeCase() { compilationHelper .setArgs(ImmutableList.of("-XDandroidCompatible=true")) - .addSourceFile("HardCodedSdCardPathNegativeCases.java") + .addSourceFile("testdata/HardCodedSdCardPathNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/android/ParcelableCreatorTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/android/ParcelableCreatorTest.java index f857c1faa364..2f01e4ebd441 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/android/ParcelableCreatorTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/android/ParcelableCreatorTest.java @@ -37,11 +37,11 @@ public class ParcelableCreatorTest { @Test public void positive() { - compilationHelper.addSourceFile("ParcelableCreatorPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ParcelableCreatorPositiveCases.java").doTest(); } @Test public void negative() { - compilationHelper.addSourceFile("ParcelableCreatorNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/ParcelableCreatorNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/android/RectIntersectReturnValueIgnoredTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/android/RectIntersectReturnValueIgnoredTest.java index b6bd79fcaffa..11d45a794acb 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/android/RectIntersectReturnValueIgnoredTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/android/RectIntersectReturnValueIgnoredTest.java @@ -34,11 +34,15 @@ public class RectIntersectReturnValueIgnoredTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("RectIntersectReturnValueIgnoredPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/RectIntersectReturnValueIgnoredPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("RectIntersectReturnValueIgnoredNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/RectIntersectReturnValueIgnoredNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/CollectionIncompatibleTypeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/CollectionIncompatibleTypeTest.java index a0026c6f1e3f..d862a2a10f45 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/CollectionIncompatibleTypeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/CollectionIncompatibleTypeTest.java @@ -38,22 +38,26 @@ public class CollectionIncompatibleTypeTest { @Test public void positiveCases() { - compilationHelper.addSourceFile("CollectionIncompatibleTypePositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/CollectionIncompatibleTypePositiveCases.java") + .doTest(); } @Test public void negativeCases() { - compilationHelper.addSourceFile("CollectionIncompatibleTypeNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/CollectionIncompatibleTypeNegativeCases.java") + .doTest(); } @Test public void outOfBounds() { - compilationHelper.addSourceFile("CollectionIncompatibleTypeOutOfBounds.java").doTest(); + compilationHelper.addSourceFile("testdata/CollectionIncompatibleTypeOutOfBounds.java").doTest(); } @Test public void classCast() { - compilationHelper.addSourceFile("CollectionIncompatibleTypeClassCast.java").doTest(); + compilationHelper.addSourceFile("testdata/CollectionIncompatibleTypeClassCast.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/IncompatibleArgumentTypeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/IncompatibleArgumentTypeTest.java index df7a066d6c39..692187cbcfaf 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/IncompatibleArgumentTypeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/collectionincompatibletype/IncompatibleArgumentTypeTest.java @@ -30,22 +30,28 @@ public class IncompatibleArgumentTypeTest { @Test public void genericMethod() { - compilationHelper.addSourceFile("IncompatibleArgumentTypeGenericMethod.java").doTest(); + compilationHelper.addSourceFile("testdata/IncompatibleArgumentTypeGenericMethod.java").doTest(); } @Test public void owningTypes() { - compilationHelper.addSourceFile("IncompatibleArgumentTypeEnclosingTypes.java").doTest(); + compilationHelper + .addSourceFile("testdata/IncompatibleArgumentTypeEnclosingTypes.java") + .doTest(); } @Test public void multimapIntegration() { - compilationHelper.addSourceFile("IncompatibleArgumentTypeMultimapIntegration.java").doTest(); + compilationHelper + .addSourceFile("testdata/IncompatibleArgumentTypeMultimapIntegration.java") + .doTest(); } @Test public void intersectionTypes() { - compilationHelper.addSourceFile("IncompatibleArgumentTypeIntersectionTypes.java").doTest(); + compilationHelper + .addSourceFile("testdata/IncompatibleArgumentTypeIntersectionTypes.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/flogger/FloggerRedundantIsEnabledTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/flogger/FloggerRedundantIsEnabledTest.java index 8edefb0a7e7c..a822f316092f 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/flogger/FloggerRedundantIsEnabledTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/flogger/FloggerRedundantIsEnabledTest.java @@ -34,19 +34,23 @@ public class FloggerRedundantIsEnabledTest { @Test public void doPositiveCases() { - compilationTestHelper.addSourceFile("FloggerRedundantIsEnabledPositiveCases.java").doTest(); + compilationTestHelper + .addSourceFile("testdata/FloggerRedundantIsEnabledPositiveCases.java") + .doTest(); } @Test public void doNegativeCases() { - compilationTestHelper.addSourceFile("FloggerRedundantIsEnabledNegativeCases.java").doTest(); + compilationTestHelper + .addSourceFile("testdata/FloggerRedundantIsEnabledNegativeCases.java") + .doTest(); } @Test public void fixes() { BugCheckerRefactoringTestHelper.newInstance(FloggerRedundantIsEnabled.class, getClass()) - .addInput("FloggerRedundantIsEnabledPositiveCases.java") - .addOutput("FloggerRedundantIsEnabledPositiveCases_expected.java") + .addInput("testdata/FloggerRedundantIsEnabledPositiveCases.java") + .addOutput("testdata/FloggerRedundantIsEnabledPositiveCases_expected.java") .doTest(TestMode.AST_MATCH); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnConstructorsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnConstructorsTest.java index 92dd795b1614..1770f10628e4 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnConstructorsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnConstructorsTest.java @@ -33,14 +33,14 @@ public class AssistedInjectAndInjectOnConstructorsTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("AssistedInjectAndInjectOnConstructorsPositiveCases.java") + .addSourceFile("testdata/AssistedInjectAndInjectOnConstructorsPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("AssistedInjectAndInjectOnConstructorsNegativeCases.java") + .addSourceFile("testdata/AssistedInjectAndInjectOnConstructorsNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnSameConstructorTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnSameConstructorTest.java index 184bf770c354..8f5adc776c0d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnSameConstructorTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/AssistedInjectAndInjectOnSameConstructorTest.java @@ -33,14 +33,14 @@ public class AssistedInjectAndInjectOnSameConstructorTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("AssistedInjectAndInjectOnSameConstructorPositiveCases.java") + .addSourceFile("testdata/AssistedInjectAndInjectOnSameConstructorPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("AssistedInjectAndInjectOnSameConstructorNegativeCases.java") + .addSourceFile("testdata/AssistedInjectAndInjectOnSameConstructorNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/AutoFactoryAtInjectTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/AutoFactoryAtInjectTest.java index 33dc2b042983..70f6e484e66d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/AutoFactoryAtInjectTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/AutoFactoryAtInjectTest.java @@ -32,11 +32,11 @@ public class AutoFactoryAtInjectTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("AutoFactoryAtInjectPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AutoFactoryAtInjectPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("AutoFactoryAtInjectNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AutoFactoryAtInjectNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/CloseableProvidesTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/CloseableProvidesTest.java index c579909b473e..2c7134825549 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/CloseableProvidesTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/CloseableProvidesTest.java @@ -32,11 +32,11 @@ public class CloseableProvidesTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("CloseableProvidesPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/CloseableProvidesPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("CloseableProvidesNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/CloseableProvidesNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectOnMemberAndConstructorTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectOnMemberAndConstructorTest.java index e00ef2141962..1962e6b28c8c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectOnMemberAndConstructorTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectOnMemberAndConstructorTest.java @@ -79,6 +79,8 @@ public InjectOnMemberAndConstructorPositiveCases( @Test public void negativeCase() { - compilationHelper.addSourceFile("InjectOnMemberAndConstructorNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/InjectOnMemberAndConstructorNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectedConstructorAnnotationsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectedConstructorAnnotationsTest.java index 6e281df7a20e..aec5f90490f0 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectedConstructorAnnotationsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/InjectedConstructorAnnotationsTest.java @@ -30,11 +30,15 @@ public class InjectedConstructorAnnotationsTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("InjectedConstructorAnnotationsPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/InjectedConstructorAnnotationsPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("InjectedConstructorAnnotationsNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/InjectedConstructorAnnotationsNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/InvalidTargetingOnScopingAnnotationTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/InvalidTargetingOnScopingAnnotationTest.java index 37ac24f9c0d1..755891712706 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/InvalidTargetingOnScopingAnnotationTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/InvalidTargetingOnScopingAnnotationTest.java @@ -33,14 +33,14 @@ public class InvalidTargetingOnScopingAnnotationTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("InvalidTargetingOnScopingAnnotationPositiveCases.java") + .addSourceFile("testdata/InvalidTargetingOnScopingAnnotationPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("InvalidTargetingOnScopingAnnotationNegativeCases.java") + .addSourceFile("testdata/InvalidTargetingOnScopingAnnotationNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnAbstractMethodTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnAbstractMethodTest.java index 3354a10e0276..97cfff4fe67b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnAbstractMethodTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnAbstractMethodTest.java @@ -32,11 +32,15 @@ public class JavaxInjectOnAbstractMethodTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("JavaxInjectOnAbstractMethodPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/JavaxInjectOnAbstractMethodPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("JavaxInjectOnAbstractMethodNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/JavaxInjectOnAbstractMethodNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnFinalFieldTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnFinalFieldTest.java index b2178abff231..d46241f9d9ba 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnFinalFieldTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/JavaxInjectOnFinalFieldTest.java @@ -31,11 +31,11 @@ public class JavaxInjectOnFinalFieldTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("JavaxInjectOnFinalFieldPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JavaxInjectOnFinalFieldPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("JavaxInjectOnFinalFieldNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/JavaxInjectOnFinalFieldNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MissingRuntimeRetentionTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MissingRuntimeRetentionTest.java index 43584023d644..db0b33651dd5 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MissingRuntimeRetentionTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MissingRuntimeRetentionTest.java @@ -37,12 +37,12 @@ public class MissingRuntimeRetentionTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("MissingRuntimeRetentionPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MissingRuntimeRetentionPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("MissingRuntimeRetentionNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MissingRuntimeRetentionNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneInjectableConstructorTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneInjectableConstructorTest.java index fc74229d8c4c..5f2c82ae0a10 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneInjectableConstructorTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneInjectableConstructorTest.java @@ -32,11 +32,15 @@ public class MoreThanOneInjectableConstructorTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("MoreThanOneInjectableConstructorPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/MoreThanOneInjectableConstructorPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("MoreThanOneInjectableConstructorNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/MoreThanOneInjectableConstructorNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneQualifierTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneQualifierTest.java index 53434f9395f7..5f469c9fd49f 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneQualifierTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneQualifierTest.java @@ -32,11 +32,11 @@ public class MoreThanOneQualifierTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("MoreThanOneQualifierPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MoreThanOneQualifierPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("MoreThanOneQualifierNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/MoreThanOneQualifierNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClassTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClassTest.java index efde8f5d64a3..2773fb358cf3 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClassTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClassTest.java @@ -31,11 +31,15 @@ public class MoreThanOneScopeAnnotationOnClassTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("MoreThanOneScopeAnnotationOnClassPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/MoreThanOneScopeAnnotationOnClassPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("MoreThanOneScopeAnnotationOnClassNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/MoreThanOneScopeAnnotationOnClassNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/OverlappingQualifierAndScopeAnnotationTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/OverlappingQualifierAndScopeAnnotationTest.java index b4fd31022e0c..be742c055c85 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/OverlappingQualifierAndScopeAnnotationTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/OverlappingQualifierAndScopeAnnotationTest.java @@ -33,14 +33,14 @@ public class OverlappingQualifierAndScopeAnnotationTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("OverlappingQualifierAndScopeAnnotationPositiveCases.java") + .addSourceFile("testdata/OverlappingQualifierAndScopeAnnotationPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("OverlappingQualifierAndScopeAnnotationNegativeCases.java") + .addSourceFile("testdata/OverlappingQualifierAndScopeAnnotationNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/QualifierWithTypeUseTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/QualifierWithTypeUseTest.java index cd517abbf658..f106e013eeb8 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/QualifierWithTypeUseTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/QualifierWithTypeUseTest.java @@ -32,11 +32,11 @@ public class QualifierWithTypeUseTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("QualifierWithTypeUsePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/QualifierWithTypeUsePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("QualifierWithTypeUseNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/QualifierWithTypeUseNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/ScopeAnnotationOnInterfaceOrAbstractClassTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/ScopeAnnotationOnInterfaceOrAbstractClassTest.java index 001bd628ea5c..814af46d4194 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/ScopeAnnotationOnInterfaceOrAbstractClassTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/ScopeAnnotationOnInterfaceOrAbstractClassTest.java @@ -34,14 +34,14 @@ public class ScopeAnnotationOnInterfaceOrAbstractClassTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("ScopeAnnotationOnInterfaceOrAbstractClassPositiveCases.java") + .addSourceFile("testdata/ScopeAnnotationOnInterfaceOrAbstractClassPositiveCases.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("ScopeAnnotationOnInterfaceOrAbstractClassNegativeCases.java") + .addSourceFile("testdata/ScopeAnnotationOnInterfaceOrAbstractClassNegativeCases.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/dagger/AndroidInjectionBeforeSuperTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/dagger/AndroidInjectionBeforeSuperTest.java index ee03df186a1a..7c29e43287ad 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/dagger/AndroidInjectionBeforeSuperTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/dagger/AndroidInjectionBeforeSuperTest.java @@ -38,16 +38,16 @@ public final class AndroidInjectionBeforeSuperTest { @Test public void positiveCase() { compilationHelper - .addSourceFile("AndroidInjectionBeforeSuperPositiveCases.java") - .addSourceFile("AndroidInjection.java") + .addSourceFile("testdata/AndroidInjectionBeforeSuperPositiveCases.java") + .addSourceFile("testdata/AndroidInjection.java") .doTest(); } @Test public void negativeCase() { compilationHelper - .addSourceFile("AndroidInjectionBeforeSuperNegativeCases.java") - .addSourceFile("AndroidInjection.java") + .addSourceFile("testdata/AndroidInjectionBeforeSuperNegativeCases.java") + .addSourceFile("testdata/AndroidInjection.java") .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedInjectScopingTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedInjectScopingTest.java index 6c8fee99d9da..18e2badb5a77 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedInjectScopingTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedInjectScopingTest.java @@ -32,11 +32,11 @@ public class AssistedInjectScopingTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("AssistedInjectScopingPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AssistedInjectScopingPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("AssistedInjectScopingNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AssistedInjectScopingNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedParametersTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedParametersTest.java index f6351fea913b..f2b8ba665860 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedParametersTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/AssistedParametersTest.java @@ -32,11 +32,11 @@ public class AssistedParametersTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("AssistedParametersPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AssistedParametersPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("AssistedParametersNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/AssistedParametersNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/BindingToUnqualifiedCommonTypeTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/BindingToUnqualifiedCommonTypeTest.java index eb295a43183b..dcda76c3a2b7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/BindingToUnqualifiedCommonTypeTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/BindingToUnqualifiedCommonTypeTest.java @@ -31,11 +31,15 @@ public class BindingToUnqualifiedCommonTypeTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("BindingToUnqualifiedCommonTypePositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/BindingToUnqualifiedCommonTypePositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("BindingToUnqualifiedCommonTypeNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/BindingToUnqualifiedCommonTypeNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/InjectOnFinalFieldTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/InjectOnFinalFieldTest.java index 0bae3d40b401..c4136128a703 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/InjectOnFinalFieldTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/InjectOnFinalFieldTest.java @@ -31,11 +31,11 @@ public class InjectOnFinalFieldTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("InjectOnFinalFieldPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/InjectOnFinalFieldPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("InjectOnFinalFieldNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/InjectOnFinalFieldNegativeCases.java").doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesGuiceInjectableMethodTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesGuiceInjectableMethodTest.java index 80eec8b5dd13..5ed2be1d8e94 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesGuiceInjectableMethodTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesGuiceInjectableMethodTest.java @@ -31,11 +31,15 @@ public class OverridesGuiceInjectableMethodTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("OverridesGuiceInjectableMethodPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/OverridesGuiceInjectableMethodPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("OverridesGuiceInjectableMethodNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/OverridesGuiceInjectableMethodNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesJavaxInjectableMethodTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesJavaxInjectableMethodTest.java index 5b88e7ac2b5b..f7e21cfdb925 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesJavaxInjectableMethodTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/OverridesJavaxInjectableMethodTest.java @@ -31,11 +31,15 @@ public class OverridesJavaxInjectableMethodTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("OverridesJavaxInjectableMethodPositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/OverridesJavaxInjectableMethodPositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("OverridesJavaxInjectableMethodNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/OverridesJavaxInjectableMethodNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/ProvidesMethodOutsideOfModuleTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/ProvidesMethodOutsideOfModuleTest.java index 8f5edc65b75c..cd5c28f3071c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/ProvidesMethodOutsideOfModuleTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/ProvidesMethodOutsideOfModuleTest.java @@ -31,11 +31,15 @@ public class ProvidesMethodOutsideOfModuleTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("ProvidesMethodOutsideOfModulePositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ProvidesMethodOutsideOfModulePositiveCases.java") + .doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("ProvidesMethodOutsideOfModuleNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/ProvidesMethodOutsideOfModuleNegativeCases.java") + .doTest(); } } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsBrokenForNullTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsBrokenForNullTest.java index 405516ce63a8..9df780fcd38d 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsBrokenForNullTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsBrokenForNullTest.java @@ -32,12 +32,12 @@ public class EqualsBrokenForNullTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("EqualsBrokenForNullPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsBrokenForNullPositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("EqualsBrokenForNullNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/EqualsBrokenForNullNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullablePrimitiveTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullablePrimitiveTest.java index 7413d47220d6..884dfc5b03d8 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullablePrimitiveTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullablePrimitiveTest.java @@ -31,12 +31,12 @@ public class NullablePrimitiveTest { @Test public void positiveCase() { - compilationHelper.addSourceFile("NullablePrimitivePositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NullablePrimitivePositiveCases.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("NullablePrimitiveNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/NullablePrimitiveNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnnecessaryCheckNotNullTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnnecessaryCheckNotNullTest.java index 5a9c1524eb1f..623e08cd2bd7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnnecessaryCheckNotNullTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnnecessaryCheckNotNullTest.java @@ -168,22 +168,26 @@ void negative() { @Test public void positiveCase() { - compilationHelper.addSourceFile("UnnecessaryCheckNotNullPositiveCase.java").doTest(); + compilationHelper.addSourceFile("testdata/UnnecessaryCheckNotNullPositiveCase.java").doTest(); } @Test public void negativeCase() { - compilationHelper.addSourceFile("UnnecessaryCheckNotNullNegativeCase.java").doTest(); + compilationHelper.addSourceFile("testdata/UnnecessaryCheckNotNullNegativeCase.java").doTest(); } @Test public void primitivePositiveCases() { - compilationHelper.addSourceFile("UnnecessaryCheckNotNullPrimitivePositiveCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/UnnecessaryCheckNotNullPrimitivePositiveCases.java") + .doTest(); } @Test public void primitiveNegativeCases() { - compilationHelper.addSourceFile("UnnecessaryCheckNotNullPrimitiveNegativeCases.java").doTest(); + compilationHelper + .addSourceFile("testdata/UnnecessaryCheckNotNullPrimitiveNegativeCases.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java index 1b873316da45..634990338645 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java @@ -30,7 +30,7 @@ public class UnsafeWildcardTest { @Test public void unsoundGenericMethod() { - compilationHelper.addSourceFile("UnsoundGenericMethod.java").doTest(); + compilationHelper.addSourceFile("testdata/UnsoundGenericMethod.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/overloading/InconsistentOverloadsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/overloading/InconsistentOverloadsTest.java index ecce1d6f8623..28a97ae65652 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/overloading/InconsistentOverloadsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/overloading/InconsistentOverloadsTest.java @@ -33,42 +33,56 @@ public final class InconsistentOverloadsTest { @Test public void inconsistentOverloadsNegativeCases() { - compilationHelper.addSourceFile("InconsistentOverloadsNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/InconsistentOverloadsNegativeCases.java").doTest(); } @Test public void inconsistentOverloadsPositiveCasesAnnotations() { - compilationHelper.addSourceFile("InconsistentOverloadsPositiveCasesAnnotations.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentOverloadsPositiveCasesAnnotations.java") + .doTest(); } @Test public void inconsistentOverloadsPositiveCasesGeneral() { - compilationHelper.addSourceFile("InconsistentOverloadsPositiveCasesGeneral.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentOverloadsPositiveCasesGeneral.java") + .doTest(); } @Test public void inconsistentOverloadsPositiveCasesGenerics() { - compilationHelper.addSourceFile("InconsistentOverloadsPositiveCasesGenerics.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentOverloadsPositiveCasesGenerics.java") + .doTest(); } @Test public void inconsistentOverloadsPositiveCasesInterleaved() { - compilationHelper.addSourceFile("InconsistentOverloadsPositiveCasesInterleaved.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentOverloadsPositiveCasesInterleaved.java") + .doTest(); } @Test public void inconsistentOverloadsPositiveCasesSimple() { - compilationHelper.addSourceFile("InconsistentOverloadsPositiveCasesSimple.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentOverloadsPositiveCasesSimple.java") + .doTest(); } @Test public void inconsistentOverloadsPositiveCasesVarargs() { - compilationHelper.addSourceFile("InconsistentOverloadsPositiveCasesVarargs.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentOverloadsPositiveCasesVarargs.java") + .doTest(); } @Test public void inconsistentOverloadsOverrides() { - compilationHelper.addSourceFile("InconsistentOverloadsPositiveCasesOverrides.java").doTest(); + compilationHelper + .addSourceFile("testdata/InconsistentOverloadsPositiveCasesOverrides.java") + .doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/time/TimeUnitMismatchTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/time/TimeUnitMismatchTest.java index 852b205a18a5..8f9b000d3855 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/time/TimeUnitMismatchTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/time/TimeUnitMismatchTest.java @@ -38,12 +38,12 @@ public class TimeUnitMismatchTest { @Test public void testPositiveCase() { - compilationHelper.addSourceFile("TimeUnitMismatchPositiveCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TimeUnitMismatchPositiveCases.java").doTest(); } @Test public void testNegativeCase() { - compilationHelper.addSourceFile("TimeUnitMismatchNegativeCases.java").doTest(); + compilationHelper.addSourceFile("testdata/TimeUnitMismatchNegativeCases.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTest.java b/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTest.java index f58e47ee7900..2de6c8dcc8f3 100644 --- a/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTest.java +++ b/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTest.java @@ -123,42 +123,42 @@ public static void triggerNullnessCheckerOnPrimitive(short s) {} @Test public void transferFunctions1() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases1.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases1.java").doTest(); } @Test public void transferFunctions2() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases2.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases2.java").doTest(); } @Test public void transferFunctions3() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases3.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases3.java").doTest(); } @Test public void transferFunctions4() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases4.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases4.java").doTest(); } @Test public void transferFunctions5() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases5.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases5.java").doTest(); } @Test public void transferFunctions6() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases6.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases6.java").doTest(); } @Test public void transferFunctions7() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases7.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases7.java").doTest(); } @Test public void transferFunctions8() { - compilationHelper.addSourceFile("NullnessPropagationTransferCases8.java").doTest(); + compilationHelper.addSourceFile("testdata/NullnessPropagationTransferCases8.java").doTest(); } @Test diff --git a/core/src/test/java/com/google/errorprone/suppress/SuppressLintTest.java b/core/src/test/java/com/google/errorprone/suppress/SuppressLintTest.java index 4a741579b6aa..06c536fa24cd 100644 --- a/core/src/test/java/com/google/errorprone/suppress/SuppressLintTest.java +++ b/core/src/test/java/com/google/errorprone/suppress/SuppressLintTest.java @@ -51,7 +51,7 @@ public void setUp() { @Test public void negativeCase() { ImmutableList sources = - forResources(getClass(), "SuppressLintNegativeCases.java"); + forResources(getClass(), "testdata/SuppressLintNegativeCases.java"); JavaFileObject stub = forSourceLines( "SuppressLint.java", diff --git a/core/src/test/java/com/google/errorprone/suppress/SuppressWarningsTest.java b/core/src/test/java/com/google/errorprone/suppress/SuppressWarningsTest.java index 046eac27dd6a..9bc3780113fd 100644 --- a/core/src/test/java/com/google/errorprone/suppress/SuppressWarningsTest.java +++ b/core/src/test/java/com/google/errorprone/suppress/SuppressWarningsTest.java @@ -53,7 +53,7 @@ public void setUp() { @Test public void negativeCase() { ImmutableList sources = - forResources(getClass(), "SuppressWarningsNegativeCases.java"); + forResources(getClass(), "testdata/SuppressWarningsNegativeCases.java"); assertThat(compiler.compile(sources), is(Result.OK)); } } diff --git a/core/src/test/java/com/google/errorprone/suppress/UnsuppressibleTest.java b/core/src/test/java/com/google/errorprone/suppress/UnsuppressibleTest.java index 474e4831dbec..960505c8e988 100644 --- a/core/src/test/java/com/google/errorprone/suppress/UnsuppressibleTest.java +++ b/core/src/test/java/com/google/errorprone/suppress/UnsuppressibleTest.java @@ -75,7 +75,7 @@ public void setUp() { @Test public void positiveCase() { ImmutableList sources = - forResources(getClass(), "UnsuppressiblePositiveCases.java"); + forResources(getClass(), "testdata/UnsuppressiblePositiveCases.java"); assertThat(compiler.compile(sources), is(Result.ERROR)); assertThat(diagnosticHelper.getDiagnostics().toString(), containsString("[MyChecker]")); }