Package: groovy.org.codenarc.rule.junit

## [Groovy] Class JUnitUtil

- groovy.org.codenarc.rule.junit.JUnitUtil

- Utility methods for JUnit rule classes. This class is not intended for general use.

  Authors:
    Chris Mair

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected static boolean` | `isAssertCallWithConstantValue(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName, Object value)` Return true if the MethodCallExpression represents a JUnit assert method call with the specified method name and constant argument value.
    `` | `protected static boolean` | `isAssertCallWithLiteralValue(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName, boolean literalEvaluatesToTrue)` Return true if the MethodCallExpression represents a JUnit assert method call with the specified method name and constant argument value.
    `` | `protected static boolean` | `isAssertCallWithNonNullConstantValue(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName)`
    `` | `protected static boolean` | `isSetUpMethod(org.codehaus.groovy.ast.MethodNode methodNode)`
    `` | `protected static boolean` | `isTearDownMethod(org.codehaus.groovy.ast.MethodNode methodNode)`
    `` | `static boolean` | `isTestMethod(org.codehaus.groovy.ast.ASTNode node)` Tells you if an ASTNode is a test MethodNode.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, toString, hashCode, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### protected static boolean isAssertCallWithConstantValue(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName, Object value)

      Return true if the MethodCallExpression represents a JUnit assert method call with the specified method name and constant argument value. This handles either single-argument assert calls or 2-argument assert methods where the first parameter is the assertion message.

      Parameters:
        `methodCall` - - the MethodCallExpression of the method call
        `methodName` - - the name of the method
        `value` - - the argument value

    - #### protected static boolean isAssertCallWithLiteralValue(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName, boolean literalEvaluatesToTrue)

      Return true if the MethodCallExpression represents a JUnit assert method call with the specified method name and constant argument value. This handles either single-argument assert calls or 2-argument assert methods where the first parameter is the assertion message.

      Parameters:
        `methodCall` - - the MethodCallExpression of the method call
        `methodName` - - the name of the method
        `literalEvaluatesToTrue` - - true if the argument value must evaluate to true using Groovy truth

    - #### protected static boolean isAssertCallWithNonNullConstantValue(org.codehaus.groovy.ast.expr.MethodCallExpression methodCall, String methodName)

    - #### protected static boolean isSetUpMethod(org.codehaus.groovy.ast.MethodNode methodNode)

    - #### protected static boolean isTearDownMethod(org.codehaus.groovy.ast.MethodNode methodNode)

    - #### static boolean isTestMethod(org.codehaus.groovy.ast.ASTNode node)

      Tells you if an ASTNode is a test MethodNode. A method node is a MethodNode and is named test.* or is annotated with

      Test:
        or
      @org.junit.Test,
      Parameters:
        `node` - the node to analyze
      Returns:
        true if the node is a test method