Skip to content

Commit

Permalink
Nit: remove test prefix from JUnit4 tests.
Browse files Browse the repository at this point in the history
This is a real JUnit3-ism; the fact it's a test is adequately expressed by the @test annotation.

PiperOrigin-RevId: 499289382
  • Loading branch information
graememorgan authored and Error Prone Team committed Jan 3, 2023
1 parent ed8a1e0 commit dbd0475
Show file tree
Hide file tree
Showing 228 changed files with 1,271 additions and 1,271 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class AndroidImportOrganizerTest {
.collect(toImmutableList());

@Test
public void testStaticFirstOrdering() {
public void staticFirstOrdering() {
AndroidImportOrganizer organizer = new AndroidImportOrganizer(StaticOrder.STATIC_FIRST);
ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS);
assertThat(organized.asImportBlock())
Expand Down Expand Up @@ -79,7 +79,7 @@ public void testStaticFirstOrdering() {
}

@Test
public void testStaticLastOrdering() {
public void staticLastOrdering() {
AndroidImportOrganizer organizer = new AndroidImportOrganizer(StaticOrder.STATIC_LAST);
ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS);
assertThat(organized.asImportBlock())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class BasicImportOrganizerTest {
.collect(toImmutableList());

@Test
public void testStaticFirstOrdering() {
public void staticFirstOrdering() {
BasicImportOrganizer organizer = new BasicImportOrganizer(StaticOrder.STATIC_FIRST);
ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS);
assertThat(organized.asImportBlock())
Expand All @@ -69,7 +69,7 @@ public void testStaticFirstOrdering() {
}

@Test
public void testStaticLastOrdering() {
public void staticLastOrdering() {
BasicImportOrganizer organizer = new BasicImportOrganizer(StaticOrder.STATIC_LAST);
ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS);
assertThat(organized.asImportBlock())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class IdeaImportOrganizerTest {
.collect(toImmutableList());

@Test
public void testStaticLastOrdering() {
public void staticLastOrdering() {
IdeaImportOrganizer organizer = new IdeaImportOrganizer();
ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS);
assertThat(organized.asImportBlock())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
public class NonNullAssumptionsTest {

@Test
public void testClassesWithNonNullStaticFields() throws Exception {
public void classesWithNonNullStaticFields() throws Exception {
for (String classname : NullnessPropagationTransfer.CLASSES_WITH_NON_NULL_CONSTANTS) {
int found = 0;
Class<?> clazz = loadClass(classname);
Expand All @@ -59,7 +59,7 @@ public void testClassesWithNonNullStaticFields() throws Exception {
}

@Test
public void testNullImpliesTrueParameters() throws Exception {
public void nullImpliesTrueParameters() throws Exception {
for (MemberName member : NullnessPropagationTransfer.NULL_IMPLIES_TRUE_PARAMETERS.keySet()) {
ImmutableSet<Integer> nullParameters =
NullnessPropagationTransfer.NULL_IMPLIES_TRUE_PARAMETERS.get(member);
Expand All @@ -86,7 +86,7 @@ public void testNullImpliesTrueParameters() throws Exception {
}

@Test
public void testRequiredNonNullParameters() throws Exception {
public void requiredNonNullParameters() throws Exception {
for (MemberName member : NullnessPropagationTransfer.REQUIRED_NON_NULL_PARAMETERS.keySet()) {
ImmutableSet<Integer> nonNullParameters =
NullnessPropagationTransfer.REQUIRED_NON_NULL_PARAMETERS.get(member);
Expand Down Expand Up @@ -116,7 +116,7 @@ public void testRequiredNonNullParameters() throws Exception {
}

@Test
public void testEqualsParameters() throws Exception {
public void equalsParameters() throws Exception {
int found = 0;
for (Method method : loadClass("java.lang.Object").getMethods()) {
if (!method.getName().equals("equals")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@RunWith(JUnit4.class)
public class NullnessTest {
@Test
public void testLeastUpperBound() {
public void leastUpperBound() {
assertThat(NULLABLE.leastUpperBound(NULLABLE)).isEqualTo(NULLABLE);
assertThat(NULLABLE.leastUpperBound(NULL)).isEqualTo(NULLABLE);
assertThat(NULLABLE.leastUpperBound(NONNULL)).isEqualTo(NULLABLE);
Expand All @@ -57,7 +57,7 @@ public void testLeastUpperBound() {
}

@Test
public void testGreatestLowerBound() {
public void greatestLowerBound() {
assertThat(NULLABLE.greatestLowerBound(NULLABLE)).isEqualTo(NULLABLE);
assertThat(NULLABLE.greatestLowerBound(NULL)).isEqualTo(NULL);
assertThat(NULLABLE.greatestLowerBound(NONNULL)).isEqualTo(NONNULL);
Expand All @@ -80,7 +80,7 @@ public void testGreatestLowerBound() {
}

@Test
public void testDeducedValueWhenNotEqual() {
public void deducedValueWhenNotEqual() {
assertThat(NULLABLE.deducedValueWhenNotEqual()).isEqualTo(NULLABLE);
assertThat(NULL.deducedValueWhenNotEqual()).isEqualTo(NONNULL);
assertThat(NONNULL.deducedValueWhenNotEqual()).isEqualTo(NULLABLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class BranchedSuggestedFixesTest {

@Test
public void testCombinesBranchWithFirst() {
public void combinesBranchWithFirst() {
ImmutableList<SuggestedFix> fixes =
BranchedSuggestedFixes.builder()
.startWith(SuggestedFix.builder().addImport("A").build())
Expand All @@ -43,7 +43,7 @@ public void testCombinesBranchWithFirst() {
}

@Test
public void testEmptyIfNoProgress() {
public void emptyIfNoProgress() {
ImmutableList<SuggestedFix> fixes =
BranchedSuggestedFixes.builder()
.startWith(SuggestedFix.builder().addImport("A").build())
Expand All @@ -55,7 +55,7 @@ public void testEmptyIfNoProgress() {
}

@Test
public void testEmptyIfResumedProgress() {
public void emptyIfResumedProgress() {
ImmutableList<SuggestedFix> fixes =
BranchedSuggestedFixes.builder()
.startWith(SuggestedFix.builder().addImport("A").build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Description getDescription() {
private static final String URL = " (see https://errorprone.info/bugpattern/DeadException)";

@Test
public void testDescriptionFromBugPattern() {
public void descriptionFromBugPattern() {
Description description = new MyChecker().getDescription();
assertThat(description.checkName).isEqualTo("DeadException");
assertThat(description.getMessageWithoutCheckName())
Expand All @@ -93,7 +93,7 @@ public void testDescriptionFromBugPattern() {
}

@Test
public void testCustomDescription() {
public void customDescription() {
Description description =
new MyChecker()
.buildDescription((DiagnosticPosition) new MockTree())
Expand All @@ -117,7 +117,7 @@ Description getDescription() {
}

@Test
public void testCustomLink() {
public void customLink() {
Description description =
new CustomLinkChecker()
.buildDescription((DiagnosticPosition) new MockTree())
Expand All @@ -128,7 +128,7 @@ public void testCustomLink() {
}

@Test
public void testCustomLinkOverride() {
public void customLinkOverride() {
Description description =
new CustomLinkChecker()
.buildDescription((DiagnosticPosition) new MockTree())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Description matchReturn(ReturnTree tree, VisitorState state) {
}

@Test
public void testError() {
public void error() {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(ErrorChecker.class));
ErrorProneTestCompiler compiler = compilerBuilder.build();
Result result = compiler.compile(Arrays.asList(forSourceLines("Test.java", TEST_CODE)));
Expand All @@ -93,7 +93,7 @@ public Description matchReturn(ReturnTree tree, VisitorState state) {
}

@Test
public void testWarning() {
public void warning() {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(WarningChecker.class));
ErrorProneTestCompiler compiler = compilerBuilder.build();
Result result = compiler.compile(Arrays.asList(forSourceLines("Test.java", TEST_CODE)));
Expand All @@ -117,7 +117,7 @@ public Description matchReturn(ReturnTree tree, VisitorState state) {
}

@Test
public void testSuggestion() {
public void suggestion() {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(SuggestionChecker.class));
ErrorProneTestCompiler compiler = compilerBuilder.build();
Result result = compiler.compile(Arrays.asList(forSourceLines("Test.java", TEST_CODE)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class ErrorProneJavaCompilerTest {
@Rule public final TemporaryFolder tempDir = new TemporaryFolder();

@Test
public void testIsSupportedOption() {
public void isSupportedOption() {
ErrorProneJavaCompiler compiler = new ErrorProneJavaCompiler();

// javac options should be passed through
Expand All @@ -94,7 +94,7 @@ public void testIsSupportedOption() {
interface JavaFileObjectDiagnosticListener extends DiagnosticListener<JavaFileObject> {}

@Test
public void testGetStandardJavaFileManager() {
public void getStandardJavaFileManager() {
JavaCompiler mockCompiler = mock(JavaCompiler.class);
ErrorProneJavaCompiler compiler = new ErrorProneJavaCompiler(mockCompiler);

Expand All @@ -106,7 +106,7 @@ public void testGetStandardJavaFileManager() {
}

@Test
public void testRun() {
public void run() {
JavaCompiler mockCompiler = mock(JavaCompiler.class);
ErrorProneJavaCompiler compiler = new ErrorProneJavaCompiler(mockCompiler);

Expand All @@ -120,7 +120,7 @@ public void testRun() {
}

@Test
public void testSourceVersion() {
public void sourceVersion() {
ErrorProneJavaCompiler compiler = new ErrorProneJavaCompiler();
assertThat(compiler.getSourceVersions()).contains(SourceVersion.latest());
assertThat(compiler.getSourceVersions()).doesNotContain(SourceVersion.RELEASE_5);
Expand All @@ -140,7 +140,7 @@ public void fileWithErrorIntegrationTest() {
}

@Test
public void testWithDisabledCheck() {
public void withDisabledCheck() {
CompilationResult result =
doCompile(
Arrays.asList("bugpatterns/testdata/SelfAssignmentPositiveCases1.java"),
Expand All @@ -157,7 +157,7 @@ public void testWithDisabledCheck() {
}

@Test
public void testWithCheckPromotedToError() {
public void withCheckPromotedToError() {
CompilationResult result =
doCompile(
Arrays.asList("bugpatterns/testdata/WaitNotInLoopPositiveCases.java"),
Expand All @@ -180,7 +180,7 @@ public void testWithCheckPromotedToError() {
}

@Test
public void testWithCheckDemotedToWarning() {
public void withCheckDemotedToWarning() {
CompilationResult result =
doCompile(
Arrays.asList("bugpatterns/testdata/SelfAssignmentPositiveCases1.java"),
Expand All @@ -203,7 +203,7 @@ public void testWithCheckDemotedToWarning() {
}

@Test
public void testWithNonDefaultCheckOn() {
public void withNonDefaultCheckOn() {
CompilationResult result =
doCompile(
Arrays.asList("bugpatterns/testdata/EmptyIfStatementPositiveCases.java"),
Expand All @@ -225,7 +225,7 @@ public void testWithNonDefaultCheckOn() {
}

@Test
public void testBadFlagThrowsException() {
public void badFlagThrowsException() {
try {
doCompile(
Arrays.asList("bugpatterns/testdata/EmptyIfStatementPositiveCases.java"),
Expand All @@ -246,7 +246,7 @@ public void testBadFlagThrowsException() {
public static class UnsuppressibleArrayEquals extends ArrayEquals {}

@Test
public void testCantDisableNonDisableableCheck() {
public void cantDisableNonDisableableCheck() {
try {
doCompile(
Arrays.asList("bugpatterns/testdata/ArrayEqualsPositiveCases.java"),
Expand All @@ -259,7 +259,7 @@ public void testCantDisableNonDisableableCheck() {
}

@Test
public void testWithCustomCheckPositive() {
public void withCustomCheckPositive() {
CompilationResult result =
doCompile(
Arrays.asList("bugpatterns/testdata/BadShiftAmountPositiveCases.java"),
Expand All @@ -273,7 +273,7 @@ public void testWithCustomCheckPositive() {
}

@Test
public void testWithCustomCheckNegative() {
public void withCustomCheckNegative() {
CompilationResult result =
doCompile(
Arrays.asList("bugpatterns/testdata/SelfAssignmentPositiveCases1.java"),
Expand All @@ -284,7 +284,7 @@ public void testWithCustomCheckNegative() {
}

@Test
public void testSeverityResetsAfterOverride() throws IOException {
public void severityResetsAfterOverride() throws IOException {
DiagnosticTestHelper diagnosticHelper = new DiagnosticTestHelper();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(outputStream, UTF_8), true);
Expand Down Expand Up @@ -327,7 +327,7 @@ public void testSeverityResetsAfterOverride() throws IOException {
}

@Test
public void testMaturityResetsAfterOverride() throws Exception {
public void maturityResetsAfterOverride() throws Exception {
DiagnosticTestHelper diagnosticHelper = new DiagnosticTestHelper();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(outputStream, UTF_8), true);
Expand Down Expand Up @@ -373,7 +373,7 @@ public Description matchClass(ClassTree tree, VisitorState state) {
}

@Test
public void testFixGeneratedConstructor() {
public void fixGeneratedConstructor() {
CompilationResult result =
doCompile(
Arrays.asList("testdata/DeleteGeneratedConstructorTestCase.java"),
Expand All @@ -388,7 +388,7 @@ public void testFixGeneratedConstructor() {
}

@Test
public void testWithExcludedPaths() {
public void withExcludedPaths() {
CompilationResult result =
doCompile(
Arrays.asList("bugpatterns/testdata/SelfAssignmentPositiveCases1.java"),
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/java/com/google/errorprone/SubContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum Enum2 {
}

@Test
public void testOverlay() {
public void overlay() {
Context base = new Context();
base.put(KEY1, "key1");
base.put(Enum1.class, Enum1.VALUE1);
Expand All @@ -61,7 +61,7 @@ public void testOverlay() {
}

@Test
public void testOverride() {
public void override() {
Context base = new Context();
base.put(KEY1, "key1");
base.put(Enum1.class, Enum1.VALUE1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ public class ArrayEqualsTest {
CompilationTestHelper.newInstance(ArrayEquals.class, getClass());

@Test
public void testPositiveCase() {
public void positiveCase() {
compilationHelper.addSourceFile("ArrayEqualsPositiveCases.java").doTest();
}

@Test
public void testJava7PositiveCase() {
public void java7PositiveCase() {
compilationHelper.addSourceFile("ArrayEqualsPositiveCases2.java").doTest();
}

@Test
public void testNegativeCase() {
public void negativeCase() {
compilationHelper.addSourceFile("ArrayEqualsNegativeCases.java").doTest();
}

@Test
public void testJava7NegativeCase() {
public void java7NegativeCase() {
compilationHelper.addSourceFile("ArrayEqualsNegativeCases2.java").doTest();
}
}
Loading

0 comments on commit dbd0475

Please sign in to comment.