public class TryCatchBlockGenerator
extends Object
Creates a try-catch block around a given AssertStatement and catches a PowerAssertionError to reuse the generated visual output.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static BlockStatement |
generateTryCatchBlock(ClassNode assertionErrorClass, String message, Statement assertStatement)Wraps an assertion block so it returns a boolean result while preserving Groovy power assertion details. |
|
public static BlockStatement |
generateTryCatchBlockForInlineMode(ClassNode assertionErrorClass, String message, Statement assertStatement)Wraps an inline assertion block so a Groovy power assertion is converted into the requested violation type. |
Wraps an assertion block so it returns a boolean result while preserving Groovy power assertion details.
assertionErrorClass - the assertion violation class to instantiate on failuremessage - the message prefix to prepend to the power assertion outputassertStatement - the assertion block to executeWraps an inline assertion block so a Groovy power assertion is converted into the requested violation type.
assertionErrorClass - the assertion violation class to instantiate on failuremessage - the message prefix to prepend to the power assertion outputassertStatement - the assertion block to execute