Interface Call<R>

All Known Implementing Classes:
NormalResult, ThrowableResult

public interface Call<R>
  • Method Summary

    Modifier and Type
    Method
    Description
    default R
    Asserts that the call resulted in a result of type type and returns the result.
    default R
    Asserts that the call resulted in a result of type type and returns the result.
    assertNormal(Supplier<String> messageSupplier)
    Asserts that the call resulted in a result of type type and returns the result.
    default <E extends Throwable>
    E
    Asserts that the call resulted in n throwable of type type and returns the throwable.
    default <E extends Throwable>
    E
    assertThrows(Class<E> type, String message)
    Asserts that the call resulted in a throwable of type type and returns the throwable.
    <E extends Throwable>
    E
    assertThrows(Class<E> type, Supplier<String> messageSupplier)
    Asserts that the call resulted in a throwable of type type and returns the throwable.
  • Method Details

    • assertThrows

      <E extends Throwable> E assertThrows(Class<E> type, Supplier<String> messageSupplier) throws org.opentest4j.AssertionFailedError
      Asserts that the call resulted in a throwable of type type and returns the throwable. Otherwise, an AssertionFailedError containing the message supplied by messageSupplier will be thrown.
      messageSupplier is allowed to supply null.
      Type Parameters:
      E - the type of the expected throwable
      Parameters:
      type - the type of the expected throwable
      messageSupplier - a supplier for the message if the throwable was not thrown
      Returns:
      the throwable resulted by the call
      Throws:
      org.opentest4j.AssertionFailedError - if the call did not result in a throwable of type type
      See Also:
    • assertThrows

      default <E extends Throwable> E assertThrows(Class<E> type, String message) throws org.opentest4j.AssertionFailedError
      Asserts that the call resulted in a throwable of type type and returns the throwable. Otherwise, an AssertionFailedError containing message will be thrown.
      Type Parameters:
      E - the type of the expected throwable
      Parameters:
      type - the type of the expected throwable
      message - the message if the expected throwable was not thrown
      Returns:
      the throwable resulted by the call
      Throws:
      org.opentest4j.AssertionFailedError - if the call did not result in a throwable of type type
    • assertThrows

      default <E extends Throwable> E assertThrows(Class<E> type) throws org.opentest4j.AssertionFailedError
      Asserts that the call resulted in n throwable of type type and returns the throwable. Otherwise, an AssertionFailedError will be thrown.
      Type Parameters:
      E - the type of the expected throwable
      Parameters:
      type - the type of the expected throwable
      Returns:
      the throwable resulted by the call
      Throws:
      org.opentest4j.AssertionFailedError - if the call did not result in a throwable of type type
    • assertNormal

      R assertNormal(Supplier<String> messageSupplier) throws org.opentest4j.AssertionFailedError
      Asserts that the call resulted in a result of type type and returns the result. Otherwise, an AssertionFailedError containing the message supplied by messageSupplier will be thrown.
      messageSupplier is allowed to supply null.
      Parameters:
      messageSupplier - a supplier for the message if the throwable was not thrown
      Returns:
      the result resulted by the call
      Throws:
      org.opentest4j.AssertionFailedError - if the call resulted in a throwable
    • assertNormal

      default R assertNormal(String message) throws org.opentest4j.AssertionFailedError
      Asserts that the call resulted in a result of type type and returns the result. Otherwise, an AssertionFailedError containing message will be thrown.
      Parameters:
      message - the message if the expected throwable was not thrown
      Returns:
      the result resulted by the call
      Throws:
      org.opentest4j.AssertionFailedError - if the call resulted in a throwable
    • assertNormal

      default R assertNormal() throws org.opentest4j.AssertionFailedError
      Asserts that the call resulted in a result of type type and returns the result. Otherwise, an AssertionFailedError will be thrown.
      Returns:
      the result resulted by the call
      Throws:
      org.opentest4j.AssertionFailedError - if the call resulted in a throwable