com.googlecode.catchexception.throwable.apis
Class CatchThrowableBdd

java.lang.Object
  extended by com.googlecode.catchexception.throwable.apis.CatchThrowableBdd

Deprecated. As of release 1.3.0, replaced by com.googlecode.catchexception.throwable.apis.BDDCatchThrowable()

@Deprecated
public class CatchThrowableBdd
extends Object

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);
 

Since:
1.2.0
Author:
rwoo
See Also:
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
<T> T
when(T obj)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatchThrowableBdd

public CatchThrowableBdd()
Deprecated. 
Method Detail

when

public static <T> T when(T obj)
Deprecated. 
Type Parameters:
T - The type of the given obj.
Parameters:
obj - The instance that shall be proxied. Must not be null.
Returns:
Returns a proxy for the given object. The proxy catches throwables of the given type when a method on the proxy is called.
See Also:
CatchThrowable.catchThrowable(Object)

thenThrown

public static void thenThrown(Class actualThrowableClazz)
Deprecated. 
Throws an assertion if no throwable is thrown or if an throwable of an unexpected type is thrown.

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);
   

Parameters:
actualThrowableClazz - the expected type of the caught throwable.

then

public static org.fest.assertions.api.ThrowableAssert then(Throwable actualThrowable)
Deprecated. 
Enables FEST Fluent Assertions 2.x about the caught throwable.

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();
   

Parameters:
actualThrowable - the value to be the target of the assertions methods.
Returns:
Returns the created assertion object.
See Also:
Assertions.assertThat(Throwable)


Copyright © 2015. All rights reserved.