com.twitter.common.testing
Class EasyMockTest

java.lang.Object
  extended by com.google.common.testing.junit4.TearDownTestCase
      extended by com.twitter.common.testing.EasyMockTest
All Implemented Interfaces:
com.google.common.testing.TearDownAccepter

public abstract class EasyMockTest
extends com.google.common.testing.junit4.TearDownTestCase

A baseclass for tests that use EasyMock. A new control is set up before each test and the mocks created and replayed with it are verified during tear down.


Nested Class Summary
static class EasyMockTest.Clazz<T>
          A class meant to be sub-classed in order to capture a generic type literal value.
 
Field Summary
protected  org.easymock.IMocksControl control
           
 
Constructor Summary
EasyMockTest()
           
 
Method Summary
static
<T> org.easymock.Capture<T>
createCapture()
          A type-inferring convenience method for creating new captures.
<T> T
createMock(Class<T> type)
          Creates an EasyMock mock with this test's control.
<T> T
createMock(EasyMockTest.Clazz<T> type)
          Creates an EasyMock mock with this test's control.
 void setupEasyMock()
          Creates an EasyMock control for tests to use that will be automatically verified on tear down.
 
Methods inherited from class com.google.common.testing.junit4.TearDownTestCase
addTearDown, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

control

protected org.easymock.IMocksControl control
Constructor Detail

EasyMockTest

public EasyMockTest()
Method Detail

setupEasyMock

public final void setupEasyMock()
Creates an EasyMock control for tests to use that will be automatically verified on tear down.


createMock

public <T> T createMock(Class<T> type)
Creates an EasyMock mock with this test's control. Will be verified in a tear down.


createMock

public <T> T createMock(EasyMockTest.Clazz<T> type)
Creates an EasyMock mock with this test's control. Will be verified in a tear down. Allows for mocking of parameterized types without all the unchecked conversion warnings in a safe way.


createCapture

public static <T> org.easymock.Capture<T> createCapture()
A type-inferring convenience method for creating new captures.