Class ExpectedToFailContext

java.lang.Object
groovy.junit6.plugin.ExpectedToFailContext

public class ExpectedToFailContext extends Object
Delegate for closure predicates supplied to ExpectedToFail, exposing the thrown exception under three convenient names: ex (the Throwable itself), message (its message), and cause (its cause, possibly null).
Since:
6.0.0
  • Constructor Details

    • ExpectedToFailContext

      public ExpectedToFailContext(Throwable thrown)
      Captures thrown together with its message and cause.
      Parameters:
      thrown - the exception the predicate will inspect
  • Method Details

    • getEx

      public Throwable getEx()
      Returns the exception this context was built from.
      Returns:
      the captured exception
    • getMessage

      public String getMessage()
      Returns the message taken from the exception at construction. May be null.
      Returns:
      the captured message
    • getCause

      public Throwable getCause()
      Returns the cause taken from the exception at construction. May be null.
      Returns:
      the captured cause