biz.xsoftware.mock
Class ExpectFailedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by biz.xsoftware.mock.ExpectFailedException
All Implemented Interfaces:
Serializable

public class ExpectFailedException
extends RuntimeException

This Exception is thrown when something is expected to happen and doesn't. It is basically the assert failing. When MockSuperclass.expectEvent is called and the event doesn't come, this exception is thrown.

Author:
Dean Hiller
See Also:
Serialized Form

Field Summary
static String TIMED_OUT
          Expect failed because an event never came and waiting finally timed out.
static String UNEXPECTED_CALL_AFTER
          Expect failed because a method you did not list in expected methods was called after all your expected methods were called.
static String UNEXPECTED_CALL_BEFORE
          Expect failed because a method you did not list in expected methods was called before or during the other methods you did expect.
static String UNEXPECTED_ON_NONE
          Expect failed because you expected no methods to be called, but a method was called.
 
Constructor Summary
ExpectFailedException(String message, CalledMethod[] methods, String reason)
          Constructor for Expects that fail with a reason and message.
 
Method Summary
 CalledMethod[] getCalledMethods()
          Gives you back the CalledMethods giving you access to the parameters that were passed in and the stack traces of how they were called.
 String getReason()
          Gets the reason expecting the call(s) failed.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TIMED_OUT

public static final String TIMED_OUT
Expect failed because an event never came and waiting finally timed out.

See Also:
Constant Field Values

UNEXPECTED_CALL_AFTER

public static final String UNEXPECTED_CALL_AFTER
Expect failed because a method you did not list in expected methods was called after all your expected methods were called.

See Also:
Constant Field Values

UNEXPECTED_CALL_BEFORE

public static final String UNEXPECTED_CALL_BEFORE
Expect failed because a method you did not list in expected methods was called before or during the other methods you did expect.

See Also:
Constant Field Values

UNEXPECTED_ON_NONE

public static final String UNEXPECTED_ON_NONE
Expect failed because you expected no methods to be called, but a method was called.

See Also:
Constant Field Values
Constructor Detail

ExpectFailedException

public ExpectFailedException(String message,
                             CalledMethod[] methods,
                             String reason)
Constructor for Expects that fail with a reason and message.

Parameters:
message -
Method Detail

getReason

public String getReason()
Gets the reason expecting the call(s) failed. Returns either
  1. TIMED_OUT
  2. UNEXPECTED_CALL_AFTER
  3. UNEXPECTED_CALL_BEFORE
  4. UNEXPECTED_ON_NONE

Returns:
The reason for the failure. One of

getCalledMethods

public CalledMethod[] getCalledMethods()
Gives you back the CalledMethods giving you access to the parameters that were passed in and the stack traces of how they were called.

Returns:
The array of called methods