Package org.sonar.java.checks.helpers
Class UnitTestUtils
java.lang.Object
org.sonar.java.checks.helpers.UnitTestUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MethodMatchersstatic final Patternstatic final MethodMatchersstatic final MethodMatchersMatch when we are sure that the intention is to assert something, that will result in an AssertionError if the assertion fails.static final MethodMatchersstatic final MethodMatchers -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanhasNestedAnnotation(ClassTree tree) static booleanhasTestAnnotation(MethodTree tree) static booleanstatic booleanisTestClass(ClassTree classTree) static booleanisUnitTest(MethodTree methodTree) static booleanstatic booleanmethodNameMatchesAssertionMethodPattern(String methodName, Symbol methodSymbol)
-
Field Details
-
ASSERTION_METHODS_PATTERN
-
ASSERTION_INVOCATION_MATCHERS
-
REACTIVE_X_TEST_METHODS
-
FAIL_METHOD_MATCHER
-
ASSERTIONS_METHOD_MATCHER
-
COMMON_ASSERTION_MATCHER
Match when we are sure that the intention is to assert something, that will result in an AssertionError if the assertion fails. The purpose is not to detect any assertion method (similar to S2699).
-
-
Method Details
-
hasNestedAnnotation
-
hasTestAnnotation
-
hasJUnit5TestAnnotation
-
isInUnitTestRelatedToObjectMethods
-
isUnitTestRelatedToObjectMethods
-
isUnitTest
-
isTestClass
-
methodNameMatchesAssertionMethodPattern
-