com.googlecode.catchexception.throwable.apis.BDDCatchThrowable()
@Deprecated public class CatchThrowableBdd extends BDDCatchThrowable
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);
The Method then(Throwable)
uses FEST Fluent Assertions
2.x. You can use them directly if you like:
// import static org.fest.assertions.Assertions.assertThat;
// then we expect an IndexOutOfBoundsThrowable
assertThat(caughtThrowable())
.isInstanceOf(IndexOutOfBoundsThrowable.class)
.hasMessage("Index: 1, Size: 0")
.hasMessageStartingWith("Index: 1")
.hasMessageEndingWith("Size: 0")
.hasMessageContaining("Size")
.hasNoCause();
BDDCatchThrowable
Constructor and Description |
---|
CatchThrowableBdd()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static org.fest.assertions.api.ThrowableAssert |
then(Throwable actualThrowable)
Deprecated.
Enables FEST Fluent Assertions 2.x about the caught
throwable.
|
thenThrown, when
public CatchThrowableBdd()
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)
Copyright © 2014. All rights reserved.