net.grinder.testutility
Class CallRecorder

java.lang.Object
  extended by junit.framework.Assert
      extended by net.grinder.testutility.CallRecorder
All Implemented Interfaces:
CallAssertions
Direct Known Subclasses:
AbstractStubFactory

public class CallRecorder
extends junit.framework.Assert
implements CallAssertions

Utility class used to record and assert method invocations.

Author:
Philip Aston

Nested Class Summary
static interface CallRecorder.MethodFilter
           
 
Constructor Summary
CallRecorder()
           
 
Method Summary
 CallData assertException(String methodName, Class<?> throwableType, Class<?>... parameterTypes)
           
 CallData assertException(String methodName, Class<?> throwableType, Object... parameters)
          Check the given method was called, and that it threw an exception of the given type.
 CallData assertException(String methodName, Throwable throwable, Class<?>... parameterTypes)
           
 CallData assertException(String methodName, Throwable throwable, Object... parameters)
          Check the given method was called, and that it threw the given exception.
 void assertNoMoreCalls()
          Check that no methods have been called.
 CallData assertSuccess(String methodName, Class<?>... parameterTypes)
           
 CallData assertSuccess(String methodName, Object... parameters)
           
 String getCallHistory()
           
 CallData peekFirst()
           
 void record(CallData callData)
           
 void resetCallHistory()
          Reset the call data.
 void setIgnoreCallOrder(boolean b)
           
 void setIgnoreMethod(String methodName)
           
 void setIgnoreObjectMethods()
           
 void waitUntilCalled(int timeout)
          Wait until we're called.
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallRecorder

public CallRecorder()
Method Detail

resetCallHistory

public final void resetCallHistory()
Reset the call data.


waitUntilCalled

public void waitUntilCalled(int timeout)
Wait until we're called. Fail if we take more than timeout milliseconds.

Parameters:
timeout - Maximum time in milliseconds to wait for.

getCallHistory

public String getCallHistory()

peekFirst

public CallData peekFirst()

assertNoMoreCalls

public final void assertNoMoreCalls()
Check that no methods have been called.


setIgnoreCallOrder

public void setIgnoreCallOrder(boolean b)

setIgnoreObjectMethods

public void setIgnoreObjectMethods()

setIgnoreMethod

public void setIgnoreMethod(String methodName)

record

public final void record(CallData callData)

assertSuccess

public final CallData assertSuccess(String methodName,
                                    Object... parameters)
Specified by:
assertSuccess in interface CallAssertions

assertSuccess

public final CallData assertSuccess(String methodName,
                                    Class<?>... parameterTypes)
Specified by:
assertSuccess in interface CallAssertions

assertException

public final CallData assertException(String methodName,
                                      Throwable throwable,
                                      Object... parameters)
Description copied from interface: CallAssertions
Check the given method was called, and that it threw the given exception.

Specified by:
assertException in interface CallAssertions

assertException

public final CallData assertException(String methodName,
                                      Throwable throwable,
                                      Class<?>... parameterTypes)
Specified by:
assertException in interface CallAssertions

assertException

public final CallData assertException(String methodName,
                                      Class<?> throwableType,
                                      Object... parameters)
Description copied from interface: CallAssertions
Check the given method was called, and that it threw an exception of the given type.

Specified by:
assertException in interface CallAssertions

assertException

public final CallData assertException(String methodName,
                                      Class<?> throwableType,
                                      Class<?>... parameterTypes)
Specified by:
assertException in interface CallAssertions


Copyright © 2000-2012. All Rights Reserved.