net.sourceforge.hiveutils.test
Class HivemindUnitTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.jmock.core.VerifyingTestCase
              extended by org.jmock.core.MockObjectSupportTestCase
                  extended by org.jmock.MockObjectTestCase
                      extended by org.jmock.cglib.MockObjectTestCase
                          extended by net.sourceforge.hiveutils.test.HivemindUnitTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
HivemindIntegrationTestCase

public class HivemindUnitTestCase
extends org.jmock.cglib.MockObjectTestCase

Utility class that test cases can inherit in order to have better support (additional "syntactic sugar") for jMock usage.

Author:
Jean-Francois Poilpret

Field Summary
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
HivemindUnitTestCase()
           
 
Method Summary
protected  org.jmock.core.Stub defaultReturn()
          Returns a Stub that produces a default return value.
protected  java.lang.Object getArgument(java.lang.String name)
          Return the value of an argument provided to a Mock object's method and saved thanks to a SaveConstraint.
protected  org.jmock.core.Constraint isnull()
          Syntactic sugar to create an IsNull Constraint.
 void runBare()
          Overridden to reset the list of arguments values retained by the save methods.
protected  org.jmock.core.Constraint save(java.lang.String name)
          Creates a Constraint that is used in the description of the expected argument to mocked method, and that needs to be saved under a name for later use in the same test case.
protected  org.jmock.core.Constraint save(java.lang.String name, org.jmock.core.Constraint inner)
          Creates a Constraint that is used in the description of the expected argument to mocked method, and that needs to be saved under a name for later use in the same test case.
 
Methods inherited from class org.jmock.cglib.MockObjectTestCase
newCoreMock
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, defaultMockNameForType, mock, mock, never, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, isA, newDummy, newDummy, newDummy, not, or, same, stringContains
 
Methods inherited from class org.jmock.core.VerifyingTestCase
registerToVerify, unregisterToVerify, verify
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, toString
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HivemindUnitTestCase

public HivemindUnitTestCase()
Method Detail

runBare

public void runBare()
             throws java.lang.Throwable
Overridden to reset the list of arguments values retained by the save methods.

Overrides:
runBare in class org.jmock.core.VerifyingTestCase
Throws:
java.lang.Throwable

getArgument

protected java.lang.Object getArgument(java.lang.String name)
Return the value of an argument provided to a Mock object's method and saved thanks to a SaveConstraint.

Parameters:
name - name under which the argument was saved
Returns:
last value saved for this argument, or null if there was no argument saved under this name

save

protected org.jmock.core.Constraint save(java.lang.String name)
Creates a Constraint that is used in the description of the expected argument to mocked method, and that needs to be saved under a name for later use in the same test case.

Parameters:
name - name under which the argument's value will be saved
Returns:
a Constraint that can be used in the with method

save

protected org.jmock.core.Constraint save(java.lang.String name,
                                         org.jmock.core.Constraint inner)
Creates a Constraint that is used in the description of the expected argument to mocked method, and that needs to be saved under a name for later use in the same test case.

Parameters:
name - name under which the argument's value will be saved
inner - a real constraint that will be checked by jMock on the argument's value
Returns:
a Constraint that can be used in the with method

isnull

protected org.jmock.core.Constraint isnull()
Syntactic sugar to create an IsNull Constraint.


defaultReturn

protected org.jmock.core.Stub defaultReturn()
Returns a Stub that produces a default return value. This is simply syntactic sugar around new DefaultResultStub().

Returns:
stub returning a default value for a mocked method