|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.catchexception.throwable.apis.CatchThrowableBdd
com.googlecode.catchexception.throwable.apis.BDDCatchThrowable()
@Deprecated public class CatchThrowableBdd
Supports BDD-like approach to catch and verify throwables (given/when/then).
EXAMPLE: // given an empty list
List myList = new ArrayList();
// when we try to get the first element of the list
when(myList).get(1);
// then we expect an IndexOutOfBoundsThrowable
then(caughtThrowable())
.isInstanceOf(IndexOutOfBoundsThrowable.class)
.hasMessage("Index: 1, Size: 0")
.hasNoCause();
// then we expect an IndexOutOfBoundsThrowable (alternatively)
thenThrown(IndexOutOfBoundsThrowable.class);
BDDCatchThrowable| Constructor Summary | |
|---|---|
CatchThrowableBdd()
Deprecated. |
|
| Method Summary | ||
|---|---|---|
static org.fest.assertions.api.ThrowableAssert |
then(Throwable actualThrowable)
Deprecated. Enables FEST Fluent Assertions 2.x about the caught throwable. |
|
static void |
thenThrown(Class actualThrowableClazz)
Deprecated. Throws an assertion if no throwable is thrown or if an throwable of an unexpected type is thrown. |
|
static
|
when(T obj)
Deprecated. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CatchThrowableBdd()
| Method Detail |
|---|
public static <T> T when(T obj)
T - The type of the given obj.obj - The instance that shall be proxied. Must not be null.
CatchThrowable.catchThrowable(Object)public static void thenThrown(Class actualThrowableClazz)
EXAMPLE:
// given a list with nine members
List myList = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
// when we try to get the 500th member of the fellowship
when(myList).get(500);
// then we expect an IndexOutOfBoundsThrowable
thenThrown(IndexOutOfBoundsThrowable.class);
actualThrowableClazz - the expected type of the caught throwable.public static org.fest.assertions.api.ThrowableAssert then(Throwable actualThrowable)
EXAMPLE: // given an empty list
List myList = new ArrayList();
// when we try to get first element of the list
when(myList).get(1);
// then we expect an IndexOutOfBoundsThrowable
then(caughtThrowable())
.isInstanceOf(IndexOutOfBoundsThrowable.class)
.hasMessage("Index: 1, Size: 0")
.hasMessageStartingWith("Index: 1")
.hasMessageEndingWith("Size: 0")
.hasMessageContaining("Size")
.hasNoCause();
actualThrowable - the value to be the target of the assertions methods.
Assertions.assertThat(Throwable)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||