Class ThrowableAssert

    • Constructor Detail

      • ThrowableAssert

        protected ThrowableAssert​(java.lang.Throwable actual)
    • Method Detail

      • hasMessage

        public ThrowableAssert hasMessage​(java.lang.String message)
        Verifies that the message of the actual Throwable is equal to the given one.
        Parameters:
        message - the expected message.
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if the actual Throwable is null.
        java.lang.AssertionError - if the message of the actual Throwable is not equal to the given one.
      • hasNoCause

        public ThrowableAssert hasNoCause()
        Verifies that the actual Throwable does not have a cause.
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if the actual Throwable is null.
        java.lang.AssertionError - if the actual Throwable has a cause.
      • hasMessageStartingWith

        public ThrowableAssert hasMessageStartingWith​(java.lang.String description)
        Verifies that the message of the actual Throwable starts with the given description.
        Parameters:
        description - the description expected to start the actual Throwable's message.
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if the actual Throwable is null.
        java.lang.AssertionError - if the message of the actual Throwable does not start with the given description.
      • hasMessageContaining

        public ThrowableAssert hasMessageContaining​(java.lang.String description)
        Verifies that the message of the actual Throwable contains with the given description.
        Parameters:
        description - the description expected to be contained in the actual Throwable's message.
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if the actual Throwable is null.
        java.lang.AssertionError - if the message of the actual Throwable does not contain the given description.
      • hasMessageEndingWith

        public ThrowableAssert hasMessageEndingWith​(java.lang.String description)
        Verifies that the message of the actual Throwable ends with the given description.
        Parameters:
        description - the description expected to end the actual Throwable's message.
        Returns:
        this assertion object.
        Throws:
        java.lang.AssertionError - if the actual Throwable is null.
        java.lang.AssertionError - if the message of the actual Throwable does not end with the given description.