Modifier and Type | Method and Description |
---|---|
void |
assertHasCause(AssertionInfo info,
Throwable actual,
Throwable expectedCause) |
void |
assertHasCauseExactlyInstanceOf(AssertionInfo info,
Throwable actual,
Class<? extends Throwable> type)
Assert that the cause of actual
Throwable is exactly an instance of the given type. |
void |
assertHasCauseInstanceOf(AssertionInfo info,
Throwable actual,
Class<? extends Throwable> type)
Assert that the cause of actual
Throwable is an instance of the given type. |
void |
assertHasMessage(AssertionInfo info,
Throwable actual,
String message)
Asserts that the given actual
Throwable message is equal to the given one. |
void |
assertHasMessageContaining(AssertionInfo info,
Throwable actual,
String description)
Asserts that the message of the actual
Throwable contains with the given description. |
void |
assertHasMessageEndingWith(AssertionInfo info,
Throwable actual,
String description)
Asserts that the message of the actual
Throwable ends with the given description. |
void |
assertHasMessageMatching(AssertionInfo info,
Throwable actual,
String regex)
Asserts that the message of the actual
Throwable matches with the given regular expression. |
void |
assertHasMessageStartingWith(AssertionInfo info,
Throwable actual,
String description)
Asserts that the message of the actual
Throwable starts with the given description. |
void |
assertHasNoCause(AssertionInfo info,
Throwable actual)
Asserts that the actual
Throwable does not have a cause. |
void |
assertHasRootCauseExactlyInstanceOf(AssertionInfo info,
Throwable actual,
Class<? extends Throwable> type)
Assert that the root cause of actual
Throwable is exactly an instance of the given type. |
void |
assertHasRootCauseInstanceOf(AssertionInfo info,
Throwable actual,
Class<? extends Throwable> type)
Assert that the root cause of actual
Throwable is an instance of the given type. |
void |
assertHasStackTraceContaining(AssertionInfo info,
Throwable actual,
String description)
Asserts that the stack trace of the actual
Throwable contains with the given description. |
static Throwables |
instance()
Returns the singleton instance of this class.
|
public static Throwables instance()
public void assertHasMessage(AssertionInfo info, Throwable actual, String message)
Throwable
message is equal to the given one.info
- contains information about the assertion.actual
- the given Throwable
.message
- the expected message.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the message of the actual Throwable
is not equal to the given one.public void assertHasCause(AssertionInfo info, Throwable actual, Throwable expectedCause)
public void assertHasNoCause(AssertionInfo info, Throwable actual)
Throwable
does not have a cause.info
- contains information about the assertion.actual
- the given Throwable
.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the actual Throwable
has a cause.public void assertHasMessageStartingWith(AssertionInfo info, Throwable actual, String description)
Throwable
starts with the given description.info
- contains information about the assertion.actual
- the given Throwable
.description
- the description expected to start the actual Throwable
's message.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the message of the actual Throwable
does not start with the given description.public void assertHasMessageContaining(AssertionInfo info, Throwable actual, String description)
Throwable
contains with the given description.info
- contains information about the assertion.actual
- the given Throwable
.description
- the description expected to be contained in the actual Throwable
's message.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the message of the actual Throwable
does not contain the given description.public void assertHasStackTraceContaining(AssertionInfo info, Throwable actual, String description)
Throwable
contains with the given description.info
- contains information about the assertion.actual
- the given Throwable
.description
- the description expected to be contained in the actual Throwable
's stack trace.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the stack trace of the actual Throwable
does not contain the given description.public void assertHasMessageMatching(AssertionInfo info, Throwable actual, String regex)
Throwable
matches with the given regular expression.info
- contains information about the assertion.actual
- the given Throwable
.regex
- the regular expression of value expected to be matched the actual Throwable
's message.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the message of the actual Throwable
does not match the given regular expression.NullPointerException
- if the regex is nullpublic void assertHasMessageEndingWith(AssertionInfo info, Throwable actual, String description)
Throwable
ends with the given description.info
- contains information about the assertion.actual
- the given Throwable
.description
- the description expected to end the actual Throwable
's message.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the message of the actual Throwable
does not end with the given description.public void assertHasCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type)
Throwable
is an instance of the given type.info
- contains information about the assertion.actual
- the given Throwable
.type
- the expected cause type.NullPointerException
- if given type is null
.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the actual Throwable
has no cause.AssertionError
- if the cause of the actual Throwable
is not an instance of the given type.public void assertHasCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type)
Throwable
is exactly an instance of the given type.info
- contains information about the assertion.actual
- the given Throwable
.type
- the expected cause type.NullPointerException
- if given type is null
.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the actual Throwable
has no cause.AssertionError
- if the cause of the actual Throwable
is not exactly an instance of the given
type.public void assertHasRootCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type)
Throwable
is an instance of the given type.info
- contains information about the assertion.actual
- the given Throwable
.type
- the expected cause type.NullPointerException
- if given type is null
.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the actual Throwable
has no cause.AssertionError
- if the cause of the actual Throwable
is not an instance of the given type.public void assertHasRootCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type)
Throwable
is exactly an instance of the given type.info
- contains information about the assertion.actual
- the given Throwable
.type
- the expected cause type.NullPointerException
- if given type is null
.AssertionError
- if the actual Throwable
is null
.AssertionError
- if the actual Throwable
has no cause.AssertionError
- if the root cause of the actual Throwable
is not exactly an instance of the
given type.Copyright © 2013–2016 AssertJ. All rights reserved.