Class ExceptionWithWrongTypeThrownFailure

java.lang.Object
java.lang.Throwable
java.lang.Error
java.lang.AssertionError
com.github.stefanbirkner.fishbowl.ExceptionWithWrongTypeThrownFailure
All Implemented Interfaces:
Serializable

public class ExceptionWithWrongTypeThrownFailure extends AssertionError
This exception is thrown by Fishbowl.exceptionThrownBy(Statement, java.lang.Class) if the provided Statement did throw an exception that does not have the specified type. It extends AssertionError in order to trigger a test failure.
See Also:
  • Field Details

    • expectedType

      private final Class<? extends Throwable> expectedType
  • Constructor Details

    • ExceptionWithWrongTypeThrownFailure

      public ExceptionWithWrongTypeThrownFailure(Class<? extends Throwable> expectedType, Throwable thrownException)
      Creates a new ExceptionWithWrongTypeThrownFailure.
      Parameters:
      expectedType - The type of the expected exception.
      thrownException - the exception that has been thrown.
  • Method Details

    • getExpectedType

      public Class<? extends Throwable> getExpectedType()
      Returns the type of the expected exception.
      Returns:
      the type of the expected exception.
    • getThrownException

      public Throwable getThrownException()
      Returns the exception that has been thrown.
      Returns:
      the exception that has been thrown.