diff --git a/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java b/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java index 2374035625..7a7dcc4c46 100644 --- a/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java +++ b/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java @@ -52,7 +52,6 @@ public BugPatternTestDocumentation extract(ClassTree tree, Context context) { scanner.getReplacementTests()); } - // XXX: Further improve the heuristics for determining what a BugPattern test is. @Override public boolean canExtract(ClassTree tree, VisitorState state) { String className = tree.getSimpleName().toString(); diff --git a/documentation-support/src/test/java/tech/picnic/errorprone/documentation/BugPatternTestExtractorTest.java b/documentation-support/src/test/java/tech/picnic/errorprone/documentation/BugPatternTestExtractorTest.java index 87359db1e8..fe258090c4 100644 --- a/documentation-support/src/test/java/tech/picnic/errorprone/documentation/BugPatternTestExtractorTest.java +++ b/documentation-support/src/test/java/tech/picnic/errorprone/documentation/BugPatternTestExtractorTest.java @@ -13,7 +13,7 @@ final class BugPatternTestExtractorTest { @Test void noBugPatternTest(@TempDir Path outputDirectory) { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, "TestCheckerWithoutAnnotation.java", "import com.google.errorprone.bugpatterns.BugChecker;", @@ -25,59 +25,58 @@ void noBugPatternTest(@TempDir Path outputDirectory) { @Test void minimalBugPatternTest(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", + "TestCheckerTest.java", "import com.google.errorprone.BugCheckerRefactoringTestHelper;", "import com.google.errorprone.bugpatterns.BugChecker;", "import com.google.errorprone.CompilationTestHelper;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", - " CompilationTestHelper compilationTestHelper = CompilationTestHelper.newInstance(IdentityConversion.class, getClass());", + " CompilationTestHelper compilationTestHelper = CompilationTestHelper.newInstance(TestChecker.class, getClass());", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-minimal.json"); } @Test - void differentBugPatternTest(@TempDir Path outputDirectory) { - JavacTaskCompilation.compile( + void differentBugPatternAsClassVariableTest(@TempDir Path outputDirectory) { + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", + "TestCheckerTest.java", "import com.google.errorprone.BugCheckerRefactoringTestHelper;", "import com.google.errorprone.bugpatterns.BugChecker;", "import com.google.errorprone.CompilationTestHelper;", "", - "final class IdentityConversionTest {", - " private static class DifferentBugPattern extends BugChecker {}", + "final class TestCheckerTest {", + " private static class DifferentChecker extends BugChecker {}", "", - " CompilationTestHelper compilationTestHelper = CompilationTestHelper.newInstance(DifferentBugPattern.class, getClass());", + " CompilationTestHelper compilationTestHelper = CompilationTestHelper.newInstance(DifferentChecker.class, getClass());", "}"); assertThat(outputDirectory.toAbsolutePath()).isEmptyDirectory(); } @Test - void differentBugPatternWithTest(@TempDir Path outputDirectory) { - JavacTaskCompilation.compile( + void differentBugPatternAsLocalVariable(@TempDir Path outputDirectory) { + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", - "import com.google.errorprone.BugCheckerRefactoringTestHelper;", + "TestCheckerTest.java", "import com.google.errorprone.bugpatterns.BugChecker;", "import com.google.errorprone.CompilationTestHelper;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class TestChecker extends BugChecker {}", + "final class TestCheckerTest {", + " private static class DifferentChecker extends BugChecker {}", "", " @Test", " void identification() {", - " CompilationTestHelper.newInstance(TestChecker.class, getClass())", + " CompilationTestHelper.newInstance(DifferentChecker.class, getClass())", " .addSourceLines(\"A.java\", \"class A {}\")", " .doTest();", " }", @@ -88,363 +87,237 @@ void differentBugPatternWithTest(@TempDir Path outputDirectory) { @Test void bugPatternTestSingleIdentification(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", - "package pkg;", - "", - "import com.google.errorprone.BugCheckerRefactoringTestHelper;", + "TestCheckerTest.java", "import com.google.errorprone.bugpatterns.BugChecker;", - "import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;", "import com.google.errorprone.CompilationTestHelper;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", " @Test", " void identification() {", - " CompilationTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addSourceLines(", - " \"A.java\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" // BUG: Diagnostic contains:\",", - " \" Boolean b = Boolean.valueOf(Boolean.FALSE);\",", - " \" }\",", - " \"}\")", + " CompilationTestHelper.newInstance(TestChecker.class, getClass())", + " .addSourceLines(\"A.java\", \"class A {}\")", " .doTest();", " }", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-identification.json"); } @Test void bugPatternTestIdentificationMultipleSourceLines(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", + "TestCheckerTest.java", "package pkg;", "", - "import com.google.errorprone.BugCheckerRefactoringTestHelper;", "import com.google.errorprone.bugpatterns.BugChecker;", - "import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;", "import com.google.errorprone.CompilationTestHelper;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", " @Test", " void identification() {", - " CompilationTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addSourceLines(", - " \"A.java\",", - " \"public final class A {}\")", - " .addSourceLines(", - " \"B.java\",", - " \"public final class B {}\")", + " CompilationTestHelper.newInstance(TestChecker.class, getClass())", + " .addSourceLines(\"A.java\", \"class A {}\")", + " .addSourceLines(\"B.java\", \"class B {}\")", " .doTest();", " }", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-identification-two-sources.json"); } @Test void bugPatternTestSingleReplacement(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", - "package pkg;", - "", - "import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;", - "", + "TestCheckerTest.java", "import com.google.errorprone.BugCheckerRefactoringTestHelper;", + "import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;", "import com.google.errorprone.bugpatterns.BugChecker;", - "import com.google.errorprone.CompilationTestHelper;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", " @Test", " void replacement() {", - " BugCheckerRefactoringTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addInputLines(", - " \"A.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\",", - " \" }\",", - " \"}\")", - " .addOutputLines(", - " \"A.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.of();\",", - " \" }\",", - " \"}\")", - " .doTest(TEXT_MATCH);", + " BugCheckerRefactoringTestHelper.newInstance(TestChecker.class, getClass())", + " .addInputLines(\"A.java\", \"class A {}\")", + " .addOutputLines(\"A.java\", \"class A {}\")", + " .doTest(TestMode.TEXT_MATCH);", " }", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-replacement.json"); } @Test void bugPatternTestMultipleReplacementSources(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", - "package pkg;", - "", - "import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;", - "", + "TestCheckerTest.java", "import com.google.errorprone.BugCheckerRefactoringTestHelper;", + "import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;", "import com.google.errorprone.bugpatterns.BugChecker;", - "import com.google.errorprone.CompilationTestHelper;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", " @Test", " void replacement() {", - " BugCheckerRefactoringTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addInputLines(", - " \"A.java\",", - " \"public final class A {}\")", - " .addOutputLines(", - " \"A.java\",", - " \"public final class A {}\")", - " .addInputLines(", - " \"B.java\",", - " \"public final class B {}\")", - " .addOutputLines(", - " \"B.java\",", - " \"public final class B {}\")", - " .doTest(TEXT_MATCH);", + " BugCheckerRefactoringTestHelper.newInstance(TestChecker.class, getClass())", + " .addInputLines(\"A.java\", \"class A {}\")", + " .addOutputLines(\"A.java\", \"class A {}\")", + " .addInputLines(\"B.java\", \"class B {}\")", + " .addOutputLines(\"B.java\", \"class B {}\")", + " .doTest(TestMode.TEXT_MATCH);", " }", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-replacement-two-sources.json"); } @Test void bugPatternReplacementExpectUnchanged(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", - "package pkg;", - "", - "import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;", - "", + "TestCheckerTest.java", "import com.google.errorprone.BugCheckerRefactoringTestHelper;", + "import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;", "import com.google.errorprone.bugpatterns.BugChecker;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", " @Test", " void replacement() {", - " BugCheckerRefactoringTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addInputLines(", - " \"A.java\",", - " \"public final class A {}\")", + " BugCheckerRefactoringTestHelper.newInstance(TestChecker.class, getClass())", + " .addInputLines(\"A.java\", \"class A {}\")", " .expectUnchanged()", - " .doTest(TEXT_MATCH);", + " .doTest(TestMode.TEXT_MATCH);", " }", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-replacement-expect-unchanged.json"); } @Test void bugPatternTestIdentificationAndReplacement(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", - "package pkg;", - "", - "import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;", - "", + "TestCheckerTest.java", "import com.google.errorprone.BugCheckerRefactoringTestHelper;", + "import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;", "import com.google.errorprone.bugpatterns.BugChecker;", "import com.google.errorprone.CompilationTestHelper;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", " @Test", " void identification() {", - " CompilationTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addSourceLines(", - " \"A.java\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" // BUG: Diagnostic contains:\",", - " \" Boolean b = Boolean.valueOf(Boolean.FALSE);\",", - " \" }\",", - " \"}\")", + " CompilationTestHelper.newInstance(TestChecker.class, getClass())", + " .addSourceLines(\"A.java\", \"class A {}\")", " .doTest();", " }", "", " @Test", " void replacement() {", - " BugCheckerRefactoringTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addInputLines(", - " \"A.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\",", - " \" }\",", - " \"}\")", - " .addOutputLines(", - " \"A.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.of();\",", - " \" }\",", - " \"}\")", - " .doTest(TEXT_MATCH);", + " BugCheckerRefactoringTestHelper.newInstance(TestChecker.class, getClass())", + " .addInputLines(\"A.java\", \"class A {}\")", + " .addOutputLines(\"A.java\", \"class A {}\")", + " .doTest(TestMode.TEXT_MATCH);", " }", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-identification-and-replacement.json"); } @Test void bugPatternTestMultipleIdentificationAndReplacement(@TempDir Path outputDirectory) throws IOException { - JavacTaskCompilation.compile( + Compilation.compileWithDocumentationGenerator( outputDirectory, - "IdentityConversionTest.java", + "TestCheckerTest.java", "package pkg;", "", "import static com.google.errorprone.BugCheckerRefactoringTestHelper.FixChoosers.SECOND;", - "import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;", "", "import com.google.errorprone.BugCheckerRefactoringTestHelper;", + "import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;", "import com.google.errorprone.bugpatterns.BugChecker;", "import com.google.errorprone.CompilationTestHelper;", "import org.junit.jupiter.api.Test;", "", - "final class IdentityConversionTest {", - " private static class IdentityConversion extends BugChecker {}", + "final class TestCheckerTest {", + " private static class TestChecker extends BugChecker {}", "", " @Test", " void identification() {", - " CompilationTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addSourceLines(", - " \"A.java\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" // BUG: Diagnostic contains:\",", - " \" Boolean b = Boolean.valueOf(Boolean.FALSE);\",", - " \" }\",", - " \"}\")", + " CompilationTestHelper.newInstance(TestChecker.class, getClass())", + " .addSourceLines(\"A.java\", \"class A {}\")", " .doTest();", " }", "", " @Test", " void identification2() {", - " CompilationTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addSourceLines(", - " \"B.java\",", - " \"public final class B {\",", - " \" public void m() {\",", - " \" // BUG: Diagnostic contains:\",", - " \" Boolean b = Boolean.valueOf(Boolean.FALSE);\",", - " \" }\",", - " \"}\")", + " CompilationTestHelper.newInstance(TestChecker.class, getClass())", + " .addSourceLines(\"B.java\", \"class B {}\")", " .doTest();", " }", "", " @Test", " void replacementFirstSuggestedFix() {", - " BugCheckerRefactoringTestHelper.newInstance(IdentityConversion.class, getClass())", - " .addInputLines(", - " \"A.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\",", - " \" }\",", - " \"}\")", - " .addOutputLines(", - " \"A.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class A {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.of();\",", - " \" }\",", - " \"}\")", - " .doTest(TEXT_MATCH);", + " BugCheckerRefactoringTestHelper.newInstance(TestChecker.class, getClass())", + " .addInputLines(\"A.java\", \"class A {}\")", + " .addOutputLines(\"A.java\", \"class A {}\")", + " .doTest(TestMode.TEXT_MATCH);", " }", "", " @Test", " void replacementSecondSuggestedFix() {", - " BugCheckerRefactoringTestHelper.newInstance(IdentityConversion.class, getClass())", + " BugCheckerRefactoringTestHelper.newInstance(TestChecker.class, getClass())", " .setFixChooser(SECOND)", - " .addInputLines(", - " \"B.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class B {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\",", - " \" }\",", - " \"}\")", - " .addOutputLines(", - " \"B.java\",", - " \"import com.google.common.collect.ImmutableSet;\",", - " \"\",", - " \"public final class B {\",", - " \" public void m() {\",", - " \" ImmutableSet set = ImmutableSet.of();\",", - " \" }\",", - " \"}\")", - " .doTest(TEXT_MATCH);", + " .addInputLines(\"B.java\", \"class B {}\")", + " .addOutputLines(\"B.java\", \"class B {}\")", + " .doTest(TestMode.TEXT_MATCH);", " }", "}"); verifyFileMatchesResource( outputDirectory, - "bugpattern-test-IdentityConversionTest.json", + "bugpattern-test-TestCheckerTest.json", "bugpattern-test-documentation-multiple-identification-and-replacement.json"); } diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-and-replacement.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-and-replacement.json index 93ed79894a..2d73c5f85d 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-and-replacement.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-and-replacement.json @@ -1,12 +1,12 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [ - "public final class A {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n" + "class A {}\n" ], "replacementTests": [ { - "inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n", - "outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet set = ImmutableSet.of();\n }\n}\n" + "inputLines": "class A {}\n", + "outputLines": "class A {}\n" } ] -} +} \ No newline at end of file diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-two-sources.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-two-sources.json index 8bbdf7c97c..6a8868d408 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-two-sources.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification-two-sources.json @@ -1,8 +1,8 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [ - "public final class B {}\n", - "public final class A {}\n" + "class B {}\n", + "class A {}\n" ], "replacementTests": [] } diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification.json index ef8167b65a..067551ac56 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-identification.json @@ -1,7 +1,7 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [ - "public final class A {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n" + "class A {}\n" ], "replacementTests": [] } diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-minimal.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-minimal.json index 6f11e9f5cf..542d146bd4 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-minimal.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-minimal.json @@ -1,5 +1,5 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [], "replacementTests": [] } diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-multiple-identification-and-replacement.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-multiple-identification-and-replacement.json index 68e11251bf..724b392b96 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-multiple-identification-and-replacement.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-multiple-identification-and-replacement.json @@ -1,17 +1,17 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [ - "public final class A {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n", - "public final class B {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n" + "class A {}\n", + "class B {}\n" ], "replacementTests": [ { - "inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n", - "outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet set = ImmutableSet.of();\n }\n}\n" + "inputLines": "class A {}\n", + "outputLines": "class A {}\n" }, { - "inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class B {\n public void m() {\n ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n", - "outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class B {\n public void m() {\n ImmutableSet set = ImmutableSet.of();\n }\n}\n" + "inputLines": "class B {}\n", + "outputLines": "class B {}\n" } ] } diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-expect-unchanged.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-expect-unchanged.json index 3d07530187..ab0e2c831b 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-expect-unchanged.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-expect-unchanged.json @@ -1,9 +1,9 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [], "replacementTests": [ { - "inputLines": "public final class A {}\n", + "inputLines": "class A {}\n", "outputLines": "" } ] diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-two-sources.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-two-sources.json index b100945c29..f05772a58f 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-two-sources.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement-two-sources.json @@ -1,14 +1,14 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [], "replacementTests": [ { - "inputLines": "public final class B {}\n", - "outputLines": "public final class B {}\n" + "inputLines": "class B {}\n", + "outputLines": "class B {}\n" }, { - "inputLines": "public final class A {}\n", - "outputLines": "public final class A {}\n" + "inputLines": "class A {}\n", + "outputLines": "class A {}\n" } ] } diff --git a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement.json b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement.json index dcace8d33f..4a2c2e3857 100644 --- a/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement.json +++ b/documentation-support/src/test/resources/tech/picnic/errorprone/documentation/bugpattern-test-documentation-replacement.json @@ -1,10 +1,10 @@ { - "name": "IdentityConversion", + "name": "TestChecker", "identificationTests": [], "replacementTests": [ { - "inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n", - "outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet set = ImmutableSet.of();\n }\n}\n" + "inputLines": "class A {}\n", + "outputLines": "class A {}\n" } ] }