Package org.sonar.java.checks.helpers
Class UnitTestUtils
- java.lang.Object
-
- org.sonar.java.checks.helpers.UnitTestUtils
-
public final class UnitTestUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static MethodMatchersASSERTIONS_METHOD_MATCHERstatic MethodMatchersCOMMON_ASSERTION_MATCHERMatch when we are sure that the intention is to assert something, that will result in an AssertionError if the assertion fails.static MethodMatchersFAIL_METHOD_MATCHER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanhasJUnit5TestAnnotation(MethodTree tree)static booleanhasNestedAnnotation(ClassTree tree)static booleanhasTestAnnotation(MethodTree tree)static booleanisInUnitTestRelatedToObjectMethods(ExpressionTree expr)static booleanisUnitTestRelatedToObjectMethods(MethodTree method)
-
-
-
Field Detail
-
FAIL_METHOD_MATCHER
public static final MethodMatchers FAIL_METHOD_MATCHER
-
ASSERTIONS_METHOD_MATCHER
public static final MethodMatchers ASSERTIONS_METHOD_MATCHER
-
COMMON_ASSERTION_MATCHER
public static final MethodMatchers 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 Detail
-
hasNestedAnnotation
public static boolean hasNestedAnnotation(ClassTree tree)
-
hasTestAnnotation
public static boolean hasTestAnnotation(MethodTree tree)
-
hasJUnit5TestAnnotation
public static boolean hasJUnit5TestAnnotation(MethodTree tree)
-
isInUnitTestRelatedToObjectMethods
public static boolean isInUnitTestRelatedToObjectMethods(ExpressionTree expr)
-
isUnitTestRelatedToObjectMethods
public static boolean isUnitTestRelatedToObjectMethods(@Nullable MethodTree method)
-
-