de.akquinet.jbosscc.needle.mock
Class EasyMockProvider

java.lang.Object
  extended by org.easymock.EasyMockSupport
      extended by de.akquinet.jbosscc.needle.mock.EasyMockProvider
All Implemented Interfaces:
MockProvider

public class EasyMockProvider
extends org.easymock.EasyMockSupport
implements MockProvider

An EasyMock specific MockProvider implementation. For details, see the EasyMock documentation.

 Example:

 public class Test {

        private EasyMockProvider mockProvider = new EasyMockProvider();

        @Test
        public void test() {

         UserDao userDao = mockProvider.createMock(UserDao.class);

         mockProvider.replayAll();

         // ... use mocks

         mockProvider.verifyAll();
        }
 }
 


Field Summary
 
Fields inherited from class org.easymock.EasyMockSupport
controls
 
Constructor Summary
EasyMockProvider()
           
 
Method Summary
<T> T
createMockComponent(Class<T> type)
          Creates a mock object of a given class or interface.
 void resetToDefault(Object... mocks)
          Resets the given mock objects and turns them to a mock with default behavior.
<X> X
resetToDefault(Object mock)
          Resets the given mock object and turns them to a mock with default behavior.
 void resetToNice(Object... mocks)
          Resets the given mock objects and turns them to a mock with nice behavior.
<X> X
resetToNice(Object mock)
          Resets the given mock object and turns them to a mock with nice behavior.
 void resetToStrict(Object... mocks)
          Resets the given mock objects and turns them to a mock with strict behavior.
<X> X
resetToStrict(Object mock)
          Resets the given mock object and turns them to a mock with strict behavior.
 
Methods inherited from class org.easymock.EasyMockSupport
createControl, createMock, createMock, createMock, createMock, createMock, createMock, createMockBuilder, createNiceControl, createNiceMock, createNiceMock, createNiceMock, createNiceMock, createNiceMock, createNiceMock, createStrictControl, createStrictMock, createStrictMock, createStrictMock, createStrictMock, createStrictMock, createStrictMock, replayAll, resetAll, resetAllToDefault, resetAllToNice, resetAllToStrict, verifyAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EasyMockProvider

public EasyMockProvider()
Method Detail

createMockComponent

public <T> T createMockComponent(Class<T> type)
Creates a mock object of a given class or interface. By default a mock with nice behavior. Skipping creation, if the type is final or primitive. For details, see the EasyMock documentation.

Specified by:
createMockComponent in interface MockProvider
Parameters:
type - class or interface to mock
Returns:
the mock object or null, if the type is final or primitive.

resetToNice

public void resetToNice(Object... mocks)
Resets the given mock objects and turns them to a mock with nice behavior. For details, see the EasyMock documentation.

Parameters:
mocks - the mock objects

resetToNice

public <X> X resetToNice(Object mock)
Resets the given mock object and turns them to a mock with nice behavior. For details, see the EasyMock documentation.

Parameters:
mock - the mock object
Returns:
the mock object

resetToStrict

public void resetToStrict(Object... mocks)
Resets the given mock objects and turns them to a mock with strict behavior. For details, see the EasyMock documentation.

Parameters:
mocks - the mock objects

resetToStrict

public <X> X resetToStrict(Object mock)
Resets the given mock object and turns them to a mock with strict behavior. For details, see the EasyMock documentation.

Parameters:
mock - the mock objects
Returns:
the mock object

resetToDefault

public void resetToDefault(Object... mocks)
Resets the given mock objects and turns them to a mock with default behavior. For details, see the EasyMock documentation.

Parameters:
mocks - the mock objects

resetToDefault

public <X> X resetToDefault(Object mock)
Resets the given mock object and turns them to a mock with default behavior. For details, see the EasyMock documentation.

Parameters:
mock - the mock object
Returns:
the mock object


Copyright © 2013 akquinet AG. All Rights Reserved.