in module/geb-implicit-assertions/src/main/groovy/geb/transform/implicitassertions/ImplicitAssertionsTransformationVisitor.groovy [248:292]
private Statement transform(Expression expression, Statement statement, boolean appendTrueToNonAssertedStatements) {
Statement replacement
Expression recordedValueExpression = createRuntimeCall("recordValue", expression)
BooleanExpression booleanExpression = new BooleanExpression(recordedValueExpression)
Statement retrieveRecordedValueStatement = new ExpressionStatement(createRuntimeCall("retrieveRecordedValue"))
Statement withAssertion = new AssertStatement(booleanExpression)
withAssertion.sourcePosition = expression
withAssertion.statementLabel = (String) expression.getNodeMetaData("statementLabel")
BlockStatement assertAndRetrieveRecordedValue = new BlockStatement()
assertAndRetrieveRecordedValue.addStatement(withAssertion)
assertAndRetrieveRecordedValue.addStatement(retrieveRecordedValueStatement)
if (expression in MethodCallExpression) {
MethodCallExpression methodCall = expression
replacement = wrapInVoidMethodCheck(
expression,
assertAndRetrieveRecordedValue,
methodCall.objectExpression,
methodCall.method,
methodCall.arguments,
appendTrueToNonAssertedStatements
)
} else if (expression in StaticMethodCallExpression) {
StaticMethodCallExpression methodCall = expression
replacement = wrapInVoidMethodCheck(
expression,
assertAndRetrieveRecordedValue,
new ClassExpression(methodCall.ownerType),
new ConstantExpression(methodCall.method),
methodCall.arguments,
appendTrueToNonAssertedStatements
)
} else {
replacement = assertAndRetrieveRecordedValue
}
replacement.sourcePosition = statement
replacement
}