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 fors.ThrowableTo 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 protectedThrowableAssert(java.lang.Throwable actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowableAsserthasMessage(java.lang.String message)Verifies that the message of the actualThrowableis equal to the given one.ThrowableAsserthasMessageContaining(java.lang.String description)Verifies that the message of the actualThrowablecontains with the given description.ThrowableAsserthasMessageEndingWith(java.lang.String description)Verifies that the message of the actualThrowableends with the given description.ThrowableAsserthasMessageStartingWith(java.lang.String description)Verifies that the message of the actualThrowablestarts with the given description.ThrowableAsserthasNoCause()Verifies that the actualThrowabledoes 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 actualThrowableis equal to the given one.- Parameters:
message- the expected message.- Returns:
- this assertion object.
- Throws:
java.lang.AssertionError- if the actualThrowableisnull.java.lang.AssertionError- if the message of the actualThrowableis not equal to the given one.
-
hasNoCause
public ThrowableAssert hasNoCause()
Verifies that the actualThrowabledoes not have a cause.- Returns:
- this assertion object.
- Throws:
java.lang.AssertionError- if the actualThrowableisnull.java.lang.AssertionError- if the actualThrowablehas a cause.
-
hasMessageStartingWith
public ThrowableAssert hasMessageStartingWith(java.lang.String description)
Verifies that the message of the actualThrowablestarts 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 actualThrowableisnull.java.lang.AssertionError- if the message of the actualThrowabledoes not start with the given description.
-
hasMessageContaining
public ThrowableAssert hasMessageContaining(java.lang.String description)
Verifies that the message of the actualThrowablecontains 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 actualThrowableisnull.java.lang.AssertionError- if the message of the actualThrowabledoes not contain the given description.
-
hasMessageEndingWith
public ThrowableAssert hasMessageEndingWith(java.lang.String description)
Verifies that the message of the actualThrowableends 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 actualThrowableisnull.java.lang.AssertionError- if the message of the actualThrowabledoes not end with the given description.
-
-