com.hammingweight.hammock
Class HammockException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.hammingweight.hammock.HammockException

public class HammockException
extends java.lang.RuntimeException

The HammockException class encapsulates various exceptions that may be thrown by test doubles.

Since:
Hammock 1.0
Author:
C.A. Meijer

Constructor Summary
HammockException(java.lang.Class throwingClass, java.lang.String errorMessage)
          A constructor.
HammockException(MockMethod method, java.lang.String errorMessage)
          A constructor.
HammockException(java.lang.Throwable t)
          A constructor that is used when a test double tries to throw an exception from a method where the exception is inconsistent with the method's signature.
 
Method Summary
 java.lang.String getError()
          A getter method.
 java.lang.String getMessage()
          Returns a detailed error message describing the exception.
 
Methods inherited from class java.lang.Throwable
printStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HammockException

public HammockException(java.lang.Class throwingClass,
                        java.lang.String errorMessage)
A constructor.

Parameters:
throwingClass - The class of the object that threw the exception.
errorMessage - A descriptive error message.

HammockException

public HammockException(MockMethod method,
                        java.lang.String errorMessage)
A constructor.

Parameters:
method - The method invoked on a test double that led to the exception.
errorMessage - A descriptive error message.

HammockException

public HammockException(java.lang.Throwable t)
A constructor that is used when a test double tries to throw an exception from a method where the exception is inconsistent with the method's signature.

Parameters:
t - An exception that a test double tried to throw.
Method Detail

getError

public java.lang.String getError()
A getter method.

Returns:
A descriptive error message.

getMessage

public java.lang.String getMessage()
Returns a detailed error message describing the exception.

Overrides:
getMessage in class java.lang.Throwable
Returns:
A message describing what caused an exception to be thrown.