Groovy Documentation

groovy.org.codenarc.rule.junit
[Groovy] Class JUnitUtil

java.lang.Object
  groovy.org.codenarc.rule.junit.JUnitUtil

class JUnitUtil

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

Authors:
Chris Mair


Method Summary
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.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Method Detail

isAssertCallWithConstantValue

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


isAssertCallWithLiteralValue

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


isAssertCallWithNonNullConstantValue

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


isSetUpMethod

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


isTearDownMethod

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


isTestMethod

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,
Returns:
true if the node is a test method
Parameters:
node - the node to analyze


 

Groovy Documentation