Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Drop public modifier from BugPattern tests #136

Merged
merged 2 commits into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/** A {@link BugChecker} which flags non-canonical JUnit method declarations. */
// XXX: Consider introducing a class-level check which enforces that test classes:
// 1. Are named `*Test` or `Abstract*TestCase`.
// 2. If not `abstract`, don't have public methods and subclasses.
// 2. If not `abstract`, are package-private and don't have public methods and subclasses.
// 3. Only have private fields.
// XXX: If implemented, the current logic could flag only `private` JUnit methods.
@AutoService(BugChecker.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Optional;
import org.junit.jupiter.api.Test;

public final class AnnotationAttributeMatcherTest {
final class AnnotationAttributeMatcherTest {
@Test
void withoutListings() {
AnnotationAttributeMatcher matcher =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class AutowiredConstructorCheckTest {
final class AutowiredConstructorCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(AutowiredConstructorCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class CanonicalAnnotationSyntaxCheckTest {
final class CanonicalAnnotationSyntaxCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(CanonicalAnnotationSyntaxCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class EmptyMethodCheckTest {
final class EmptyMethodCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(EmptyMethodCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class FormatStringConcatenationCheckTest {
final class FormatStringConcatenationCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(FormatStringConcatenationCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class LexicographicalAnnotationAttributeListingCheckTest {
final class LexicographicalAnnotationAttributeListingCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(
LexicographicalAnnotationAttributeListingCheck.class, getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class LexicographicalAnnotationListingCheckTest {
final class LexicographicalAnnotationListingCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(LexicographicalAnnotationListingCheck.class, getClass())
.expectErrorMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.sun.source.tree.MethodInvocationTree;
import org.junit.jupiter.api.Test;

public final class MethodMatcherFactoryTest {
final class MethodMatcherFactoryTest {
/** A {@link BugChecker} which flags method invocations matched by {@link #TEST_MATCHER}. */
@BugPattern(
name = "MatchedMethodsFlagger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class MethodReferenceUsageCheckTest {
final class MethodReferenceUsageCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(MethodReferenceUsageCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class MissingRefasterAnnotationCheckTest {
final class MissingRefasterAnnotationCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(MissingRefasterAnnotationCheck.class, getClass())
.expectErrorMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class MockitoStubbingCheckTest {
final class MockitoStubbingCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(MockitoStubbingCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class PrimitiveComparisonCheckTest {
final class PrimitiveComparisonCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(PrimitiveComparisonCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// XXX: The tests below show that `String.valueOf((String) null)` may be simplified, but
// `String.valueOf(null)` may not. That is because the latter matches `String#valueOf(char[])`. We
// could special-case `null` arguments, but that doesn't seem worth the trouble.
public final class RedundantStringConversionCheckTest {
final class RedundantStringConversionCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(RedundantStringConversionCheck.class, getClass());
private final CompilationTestHelper customizedCompilationTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class RefasterAnyOfUsageCheckTest {
final class RefasterAnyOfUsageCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(RefasterAnyOfUsageCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

public final class RefasterCheckTest {
final class RefasterCheckTest {
/** The names of all Refaster template groups defined in this module. */
private static final ImmutableSet<String> TEMPLATE_GROUPS =
ImmutableSet.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

public final class ScheduledTransactionTraceCheckTest {
final class ScheduledTransactionTraceCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(ScheduledTransactionTraceCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class Slf4jLogStatementCheckTest {
final class Slf4jLogStatementCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(Slf4jLogStatementCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class SpringMvcAnnotationCheckTest {
final class SpringMvcAnnotationCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(SpringMvcAnnotationCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class StaticImportCheckTest {
final class StaticImportCheckTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(StaticImportCheck.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

public final class TimeZoneUsageCheckTest {
final class TimeZoneUsageCheckTest {
private final CompilationTestHelper compilationHelper =
CompilationTestHelper.newInstance(TimeZoneUsageCheck.class, getClass())
.expectErrorMessage(
Expand Down