jtge.util
Class EasyMockTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byjtge.util.EasyMockTestCase
All Implemented Interfaces:
junit.framework.Test

public class EasyMockTestCase
extends junit.framework.TestCase

Extends a JUnit TestCase with several EasyMock related features.

This extension provides the following benefits :

As a consequence the tests are easier to write and end up being simpler.

TODO add nice and strict mock support

Version:
$Revision: 1.8 $ $Date: 2005/08/26 18:09:37 $
Author:
Mathieu Champlon
See Also:
JUnit, EasyMock

Constructor Summary
EasyMockTestCase()
          Create an easy mock test case.
 
Method Summary
protected  org.easymock.MockControl control(java.lang.Object mock)
          Access the control object associated to a mock object.
protected  java.lang.Object createMock(java.lang.Class type)
          Factory method to create a mock object of a given type.
protected  void replay()
          Set all mock objects to replay mode.
protected  void reset()
          Reset all mock objects expectations.
 void runBare()
          
protected  void verify()
          Verify all mock objects expectations.
 
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

EasyMockTestCase

public EasyMockTestCase()
Create an easy mock test case.

Method Detail

runBare

public final void runBare()
                   throws java.lang.Throwable

Throws:
java.lang.Throwable

createMock

protected final java.lang.Object createMock(java.lang.Class type)
Factory method to create a mock object of a given type.

Parameters:
type - the type of the mock object to create
Returns:
the created mock object

reset

protected final void reset()
Reset all mock objects expectations.

The state of mock objects is then the same as at the beginning of the test.


replay

protected final void replay()
Set all mock objects to replay mode.


verify

protected final void verify()
Verify all mock objects expectations.

This method is automatically called at the end of each test.


control

protected final org.easymock.MockControl control(java.lang.Object mock)
Access the control object associated to a mock object.

Parameters:
mock - the mock object
Returns:
the control associated


Copyright © 2003-2005 . All Rights Reserved.