Package org.fest.assertions.api
Class ThrowableAssert
- java.lang.Object
-
- org.fest.assertions.api.AbstractAssert<ThrowableAssert,java.lang.Throwable>
-
- org.fest.assertions.api.ThrowableAssert
-
- All Implemented Interfaces:
Assert<ThrowableAssert,java.lang.Throwable>
,Descriptable<ThrowableAssert>
,ExtensionPoints<ThrowableAssert,java.lang.Throwable>
public class ThrowableAssert extends AbstractAssert<ThrowableAssert,java.lang.Throwable>
Assertion methods for
s.Throwable
To create a new instance of this class, invoke
.Assertions.assertThat(Throwable)
- Author:
- David DIDIER, Alex Ruiz, Joel Costigliola
-
-
Field Summary
-
Fields inherited from class org.fest.assertions.api.AbstractAssert
actual, myself
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ThrowableAssert(java.lang.Throwable actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowableAssert
hasMessage(java.lang.String message)
Verifies that the message of the actualThrowable
is equal to the given one.ThrowableAssert
hasMessageContaining(java.lang.String description)
Verifies that the message of the actualThrowable
contains with the given description.ThrowableAssert
hasMessageEndingWith(java.lang.String description)
Verifies that the message of the actualThrowable
ends with the given description.ThrowableAssert
hasMessageStartingWith(java.lang.String description)
Verifies that the message of the actualThrowable
starts with the given description.ThrowableAssert
hasNoCause()
Verifies that the actualThrowable
does not have a cause.-
Methods inherited from class org.fest.assertions.api.AbstractAssert
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, getWritableAssertionInfo, has, hashCode, hasSameClassAs, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator
-
-
-
-
Method Detail
-
hasMessage
public ThrowableAssert hasMessage(java.lang.String message)
Verifies that the message of the actualThrowable
is equal to the given one.- Parameters:
message
- the expected message.- Returns:
- this assertion object.
- Throws:
java.lang.AssertionError
- if the actualThrowable
isnull
.java.lang.AssertionError
- if the message of the actualThrowable
is not equal to the given one.
-
hasNoCause
public ThrowableAssert hasNoCause()
Verifies that the actualThrowable
does not have a cause.- Returns:
- this assertion object.
- Throws:
java.lang.AssertionError
- if the actualThrowable
isnull
.java.lang.AssertionError
- if the actualThrowable
has a cause.
-
hasMessageStartingWith
public ThrowableAssert hasMessageStartingWith(java.lang.String description)
Verifies that the message of the actualThrowable
starts with the given description.- Parameters:
description
- the description expected to start the actualThrowable
's message.- Returns:
- this assertion object.
- Throws:
java.lang.AssertionError
- if the actualThrowable
isnull
.java.lang.AssertionError
- if the message of the actualThrowable
does not start with the given description.
-
hasMessageContaining
public ThrowableAssert hasMessageContaining(java.lang.String description)
Verifies that the message of the actualThrowable
contains with the given description.- Parameters:
description
- the description expected to be contained in the actualThrowable
's message.- Returns:
- this assertion object.
- Throws:
java.lang.AssertionError
- if the actualThrowable
isnull
.java.lang.AssertionError
- if the message of the actualThrowable
does not contain the given description.
-
hasMessageEndingWith
public ThrowableAssert hasMessageEndingWith(java.lang.String description)
Verifies that the message of the actualThrowable
ends with the given description.- Parameters:
description
- the description expected to end the actualThrowable
's message.- Returns:
- this assertion object.
- Throws:
java.lang.AssertionError
- if the actualThrowable
isnull
.java.lang.AssertionError
- if the message of the actualThrowable
does not end with the given description.
-
-