Class AssertStatementCreationUtility
java.lang.Object
org.apache.groovy.contracts.generation.AssertStatementCreationUtility
Central place to create 
AssertStatement instances in groovy-contracts.
 Utilized to centralize AssertionError message generation.- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classReplaces a givenReturnStatementwith the appropriate assertion call statement and returns a result variable expression.static classReplaces a givenReturnStatementwith the appropriate assertion call statement and returns a result variable expression.static classCollects allReturnStatementinstances from a given code block.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddAssertionCallStatementToReturnStatement(BlockStatement statement, ReturnStatement returnStatement, Statement assertionCallStatement) static AssertStatementgetAssertionStatement(BooleanExpression booleanExpression) Reusable method for creating assert statements for the given booleanExpression.static BlockStatementgetAssertionStatements(List<BooleanExpression> booleanExpressions) Reusable method for creating assert statements for the given booleanExpression.static List<ReturnStatement>getReturnStatements(MethodNode method) Gets a list ofReturnStatementinstances from the givenMethodNode.static voidinjectResultVariableReturnStatementAndAssertionCallStatement(BlockStatement statement, ClassNode returnType, ReturnStatement returnStatement, BlockStatement assertionCallStatement) 
- 
Constructor Details- 
AssertStatementCreationUtilitypublic AssertStatementCreationUtility()
 
- 
- 
Method Details- 
getAssertionStatementsReusable method for creating assert statements for the given booleanExpression.- Parameters:
- booleanExpressions- the assertion's- BooleanExpressioninstances
- Returns:
- a newly created AssertStatement
 
- 
getAssertionStatementReusable method for creating assert statements for the given booleanExpression.- Parameters:
- booleanExpression- the assertion's- BooleanExpression
- Returns:
- a newly created AssertStatement
 
- 
getReturnStatementsGets a list ofReturnStatementinstances from the givenMethodNode.- Parameters:
- method- the- MethodNodethat holds the given lastStatement
- Returns:
- a ReturnStatementor null
 
- 
injectResultVariableReturnStatementAndAssertionCallStatementpublic static void injectResultVariableReturnStatementAndAssertionCallStatement(BlockStatement statement, ClassNode returnType, ReturnStatement returnStatement, BlockStatement assertionCallStatement) 
- 
addAssertionCallStatementToReturnStatementpublic static void addAssertionCallStatementToReturnStatement(BlockStatement statement, ReturnStatement returnStatement, Statement assertionCallStatement) 
 
-