EasyMockSupport (EasyMock 2.5.2 API)
Date: 2009-09-12

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.easymock
Class EasyMockSupport

    java.lang.Object
      org.easymock.EasyMockSupport

    public class EasyMockSupport

extends java.lang.Object

Helper class to be used to keep tracks of mocks easily. See EasyMock documentation and SupportTest sample

Field Summary
`protected java.util.List<IMocksControl>` | `controls` List of all controls created

Constructor Summary
`EasyMockSupport()`

Method Summary
`IMocksControl` | `createControl()` Creates a control, order checking is disabled by default.
`
`<T> T`
` | `createMock(java.lang.Class<T> toMock)` Creates a mock object that implements the given interface, order checking is disabled by default.
`
`<T> T`
` | `createMock(java.lang.String name, java.lang.Class<T> toMock)` Creates a mock object that implements the given interface, order checking is disabled by default.
`IMocksControl` | `createNiceControl()` Creates a control, order checking is disabled by default, and the mock objects created by this control will return `0`, `null` or `false` for unexpected invocations.
`
`<T> T`
` | `createNiceMock(java.lang.Class<T> toMock)` Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return `0`, `null` or `false` for unexpected invocations.
`
`<T> T`
` | `createNiceMock(java.lang.String name, java.lang.Class<T> toMock)` Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return `0`, `null` or `false` for unexpected invocations.
`IMocksControl` | `createStrictControl()` Creates a control, order checking is enabled by default.
`
`<T> T`
` | `createStrictMock(java.lang.Class<T> toMock)` Creates a mock object that implements the given interface, order checking is enabled by default.
`
`<T> T`
` | `createStrictMock(java.lang.String name, java.lang.Class<T> toMock)` Creates a mock object that implements the given interface, order checking is enabled by default.
`void` | `replayAll()` Switches all registered mock objects (more exactly: the controls of the mock objects) to replay mode.
`void` | `resetAll()` Resets all registered mock objects (more exactly: the controls of the mock objects).
`void` | `resetAllToDefault()` Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with default behavior.
`void` | `resetAllToNice()` Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with nice behavior.
`void` | `resetAllToStrict()` Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with strict behavior.
`void` | `verifyAll()` Verifies all registered mock objects (more exactly: the controls of the mock objects).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### controls

    protected final java.util.List<IMocksControl> controls

  List of all controls created

Constructor Detail

### EasyMockSupport

    public EasyMockSupport()

Method Detail

### createStrictMock

    public <T> T createStrictMock(java.lang.Class<T> toMock)

  Creates a mock object that implements the given interface, order checking is enabled by default.

  Type Parameters:
    `T` - the interface that the mock object should implement.
  Parameters:
    `toMock` - the class of the interface that the mock object should implement.
  Returns:
    the mock object.

### createStrictMock

    public <T> T createStrictMock(java.lang.String name,
                                  java.lang.Class<T> toMock)

  Creates a mock object that implements the given interface, order checking is enabled by default.

  Type Parameters:
    `T` - the interface that the mock object should implement.
  Parameters:
    `name` - the name of the mock object.
    `toMock` - the class of the interface that the mock object should implement.
  Returns:
    the mock object.
  Throws:
    `java.lang.IllegalArgumentException` - if the name is not a valid Java identifier.

### createMock

    public <T> T createMock(java.lang.Class<T> toMock)

  Creates a mock object that implements the given interface, order checking is disabled by default.

  Type Parameters:
    `T` - the interface that the mock object should implement.
  Parameters:
    `toMock` - the class of the interface that the mock object should implement.
  Returns:
    the mock object.

### createMock

    public <T> T createMock(java.lang.String name,
                            java.lang.Class<T> toMock)

  Creates a mock object that implements the given interface, order checking is disabled by default.

  Type Parameters:
    `T` - the interface that the mock object should implement.
  Parameters:
    `name` - the name of the mock object.
    `toMock` - the class of the interface that the mock object should implement.
  Returns:
    the mock object.
  Throws:
    `java.lang.IllegalArgumentException` - if the name is not a valid Java identifier.

### createNiceMock

    public <T> T createNiceMock(java.lang.Class<T> toMock)

  Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return `0`, `null` or `false` for unexpected invocations.

  Type Parameters:
    `T` - the interface that the mock object should implement.
  Parameters:
    `toMock` - the class of the interface that the mock object should implement.
  Returns:
    the mock object.

### createNiceMock

    public <T> T createNiceMock(java.lang.String name,
                                java.lang.Class<T> toMock)

  Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return `0`, `null` or `false` for unexpected invocations.

  Type Parameters:
    `T` - the interface that the mock object should implement.
  Parameters:
    `name` - the name of the mock object.
    `toMock` - the class of the interface that the mock object should implement.
  Returns:
    the mock object.
  Throws:
    `java.lang.IllegalArgumentException` - if the name is not a valid Java identifier.

### createStrictControl

    public IMocksControl createStrictControl()

  Creates a control, order checking is enabled by default.

  Returns:
    the control.

### createControl

    public IMocksControl createControl()

  Creates a control, order checking is disabled by default.

  Returns:
    the control.

### createNiceControl

    public IMocksControl createNiceControl()

  Creates a control, order checking is disabled by default, and the mock objects created by this control will return `0`, `null` or `false` for unexpected invocations.

  Returns:
    the control.

### replayAll

    public void replayAll()

  Switches all registered mock objects (more exactly: the controls of the mock objects) to replay mode. For details, see the EasyMock documentation.

### resetAll

    public void resetAll()

  Resets all registered mock objects (more exactly: the controls of the mock objects). For details, see the EasyMock documentation.

### verifyAll

    public void verifyAll()

  Verifies all registered mock objects (more exactly: the controls of the mock objects).

### resetAllToNice

    public void resetAllToNice()

  Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with nice behavior. For details, see the EasyMock documentation.

### resetAllToDefault

    public void resetAllToDefault()

  Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with default behavior. For details, see the EasyMock documentation.

### resetAllToStrict

    public void resetAllToStrict()

  Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with strict behavior. For details, see the EasyMock documentation.

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2009 OFFIS, Tammo Freese, Henri Tremblay. This documentation is provided under the terms of the Apache 2 licence.