Interface Result<RT extends Result<RT,AT,TT,ET>,AT extends Actual,TT extends Test<TT,ET,RT,AT>,ET extends Expected>

All Known Subinterfaces:
ResultOfCall, ResultOfExceptionalCall<T>, ResultOfFail, ResultOfObject<T>
All Known Implementing Classes:
BasicResult, BasicResultOfCall, BasicResultOfExceptionalCall, BasicResultOfFail, BasicResultOfObject

public interface Result<RT extends Result<RT,AT,TT,ET>,AT extends Actual,TT extends Test<TT,ET,RT,AT>,ET extends Expected>

A type representing the result of a Test.

  • Method Details

    • actual

      AT actual()

      Returns the actual of this result.

      If the test has failed due to an exception, the actual might be null and the exception trace can be retrieved using cause().

      Returns:
      the actual result of the test or null
    • cause

      Exception cause()

      If this result is not successful() due to an exception, this method returns the causing exception. Otherwise null is returned.

      Returns:
      the exception or null
    • check

      RT check(Context context, PreCommentSupplier<? super RT> preCommentSupplier) throws org.opentest4j.AssertionFailedError

      If this result is not successful, this method throws an AssertionFailedError informing about the failure.

      Parameters:
      context - the context of the test
      preCommentSupplier - the function for the pre-comment
      Returns:
      this result
      Throws:
      org.opentest4j.AssertionFailedError - if not successful
    • expected

      default ET expected()

      Returns the expected behavior of this result.

      Returns:
      the expected behavior of this result
    • successful

      default boolean successful()

      Returns if the test was successful.

      Returns:
      if the test was successful
    • test

      TT test()

      Returns the test this result belongs to.

      Returns:
      the test