Class JUnit4SetUpNotRun
java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.JUnit4SetUpNotRun
- All Implemented Interfaces:
- BugChecker.MethodTreeMatcher, Suppressible, Serializable
Checks for the existence of a JUnit3 style setUp() method in a JUnit4 test class or methods
annotated with a non-JUnit4 @Before annotation.
- Author:
- glorioso@google.com (Nick Glorioso)
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class BugCheckerBugChecker.AnnotatedTypeTreeMatcher, BugChecker.AnnotationTreeMatcher, BugChecker.ArrayAccessTreeMatcher, BugChecker.ArrayTypeTreeMatcher, BugChecker.AssertTreeMatcher, BugChecker.AssignmentTreeMatcher, BugChecker.BinaryTreeMatcher, BugChecker.BindingPatternTreeMatcher, BugChecker.BlockTreeMatcher, BugChecker.BreakTreeMatcher, BugChecker.CaseTreeMatcher, BugChecker.CatchTreeMatcher, BugChecker.ClassTreeMatcher, BugChecker.CompilationUnitTreeMatcher, BugChecker.CompoundAssignmentTreeMatcher, BugChecker.ConditionalExpressionTreeMatcher, BugChecker.ContinueTreeMatcher, BugChecker.DoWhileLoopTreeMatcher, BugChecker.EmptyStatementTreeMatcher, BugChecker.EnhancedForLoopTreeMatcher, BugChecker.ExportsTreeMatcher, BugChecker.ExpressionStatementTreeMatcher, BugChecker.ForLoopTreeMatcher, BugChecker.IdentifierTreeMatcher, BugChecker.IfTreeMatcher, BugChecker.ImportTreeMatcher, BugChecker.InstanceOfTreeMatcher, BugChecker.IntersectionTypeTreeMatcher, BugChecker.LabeledStatementTreeMatcher, BugChecker.LambdaExpressionTreeMatcher, BugChecker.LiteralTreeMatcher, BugChecker.MemberReferenceTreeMatcher, BugChecker.MemberSelectTreeMatcher, BugChecker.MethodInvocationTreeMatcher, BugChecker.MethodTreeMatcher, BugChecker.ModifiersTreeMatcher, BugChecker.ModuleTreeMatcher, BugChecker.NewArrayTreeMatcher, BugChecker.NewClassTreeMatcher, BugChecker.OpensTreeMatcher, BugChecker.PackageTreeMatcher, BugChecker.ParameterizedTypeTreeMatcher, BugChecker.ParenthesizedTreeMatcher, BugChecker.PrimitiveTypeTreeMatcher, BugChecker.ProvidesTreeMatcher, BugChecker.RequiresTreeMatcher, BugChecker.ReturnTreeMatcher, BugChecker.SuppressibleTreePathScanner<R,P>, BugChecker.SwitchExpressionTreeMatcher, BugChecker.SwitchTreeMatcher, BugChecker.SynchronizedTreeMatcher, BugChecker.ThrowTreeMatcher, BugChecker.TryTreeMatcher, BugChecker.TypeCastTreeMatcher, BugChecker.TypeParameterTreeMatcher, BugChecker.UnaryTreeMatcher, BugChecker.UnionTypeTreeMatcher, BugChecker.UsesTreeMatcher, BugChecker.VariableTreeMatcher, BugChecker.WhileLoopTreeMatcher, BugChecker.WildcardTreeMatcher, BugChecker.YieldTreeMatcher 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected List<com.google.errorprone.bugpatterns.AbstractJUnit4InitMethodNotRun.AnnotationReplacements> Returns a collection of 'before-and-after' pairs of annotations that should be replaced on these methods.protected StringReturns the fully qualified class name of the annotation this bugpattern should apply to matched methods.matchMethod(MethodTree methodTree, VisitorState state) Matches if all of the following conditions are true: 1) The method matchesmethodMatcher(), (looks like setUp() or tearDown(), and none of the overrides in the hierarchy of the method have the appropriate @Before or @After annotations) 2) The method is not annotated with @Test 3) The enclosing class has an @RunWith annotation and does not extend TestCase.protected Matcher<MethodTree> Returns a matcher that selects which methods this matcher applies to (e.g. public void setUp() without @Before/@BeforeClass annotation)Methods inherited from class BugCheckerallNames, buildDescription, buildDescription, buildDescription, canonicalName, customSuppressionAnnotations, defaultSeverity, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, disableable, equals, hashCode, isSuppressed, isSuppressed, isSuppressed, isSuppressed, linkUrl, message, supportsSuppressWarnings, suppressedByAnyOf, suppressedRegionsMethods inherited from class Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SuppressibleallNames, canonicalName, customSuppressionAnnotations, supportsSuppressWarnings, suppressedByAnyOf
- 
Constructor Details- 
JUnit4SetUpNotRunpublic JUnit4SetUpNotRun()
 
- 
- 
Method Details- 
methodMatcherReturns a matcher that selects which methods this matcher applies to (e.g. public void setUp() without @Before/@BeforeClass annotation)
- 
correctAnnotationReturns the fully qualified class name of the annotation this bugpattern should apply to matched methods.If another annotation is on the method that has the same name, the import will be replaced with the appropriate one (e.g.: com.example.Before becomes org.junit.Before) 
- 
annotationReplacementsprotected List<com.google.errorprone.bugpatterns.AbstractJUnit4InitMethodNotRun.AnnotationReplacements> annotationReplacements()Returns a collection of 'before-and-after' pairs of annotations that should be replaced on these methods.If this method matcher finds a method annotated with AbstractJUnit4InitMethodNotRun.AnnotationReplacements.badAnnotation, instead of applyingcorrectAnnotation(), instead replace it withAbstractJUnit4InitMethodNotRun.AnnotationReplacements.goodAnnotation
- 
matchMethodMatches if all of the following conditions are true: 1) The method matchesmethodMatcher(), (looks like setUp() or tearDown(), and none of the overrides in the hierarchy of the method have the appropriate @Before or @After annotations) 2) The method is not annotated with @Test 3) The enclosing class has an @RunWith annotation and does not extend TestCase. This marks that the test is intended to run with JUnit 4.- Specified by:
- matchMethodin interface- BugChecker.MethodTreeMatcher
 
 
-