IMocksControl (EasyMock 3.3.1 API)
Date: 2015-01-05

org.easymock

## Interface IMocksControl

- All Known Implementing Classes:
    MocksControl

      public interface IMocksControl

  Controls all the mock objects created by it. For details, see the EasyMock documentation.
  Author:
    OFFIS, Tammo Freese

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkIsUsedInOneThread(boolean shouldBeUsedInOneThread)` Check that the mock is called from only one thread
    `void` | `checkOrder(boolean state)` Switches order checking on and off.
    `<T> T` | `createMock(Class<T> toMock)` Creates a mock object that implements the given interface.
    `<T> T` | `createMock(Class<T> toMock, ConstructorArgs constructorArgs, Method... mockedMethods)` Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
    `<T> T` | `createMock(Class<T> toMock, Method... mockedMethods)` Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
    `<T> T` | `createMock(String name, Class<T> toMock)` Creates a mock object that implements the given interface.
    `<T> T` | `createMock(String name, Class<T> toMock, ConstructorArgs constructorArgs, Method... mockedMethods)` Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
    `<T> T` | `createMock(String name, Class<T> toMock, Method... mockedMethods)` Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
    `void` | `makeThreadSafe(boolean threadSafe)` Makes the mock thread safe.
    `void` | `replay()` Switches the control from record mode to replay mode.
    `void` | `reset()` Removes all expectations for the mock objects of this control.
    `void` | `resetToDefault()` Removes all expectations for the mock objects of this control and turn them to default mocks.
    `void` | `resetToNice()` Removes all expectations for the mock objects of this control and turn them to nice mocks.
    `void` | `resetToStrict()` Removes all expectations for the mock objects of this control and turn them to strict mocks.
    `void` | `verify()` Verifies that all expectations were met.

- - ### Method Detail

    - #### createMock

          <T> T createMock(Class<T> toMock)

      Creates a mock object that implements the given interface.
      Type Parameters:
        `T` - the interface or class that the mock object should implement/extend.
      Parameters:
        `toMock` - the interface or class that the mock object should implement/extend.
      Returns:
        the mock object.

    - #### createMock

          <T> T createMock(String name,
                           Class<T> toMock)

      Creates a mock object that implements the given interface.
      Type Parameters:
        `T` - the interface or class that the mock object should implement/extend.
      Parameters:
        `name` - the name of the mock object.
        `toMock` - the interface or class that the mock object should implement/extend.
      Returns:
        the mock object.
      Throws:
        `IllegalArgumentException` - if the name is not a valid Java identifier.

    - #### createMock

          @Deprecated
          <T> T createMock(Class<T> toMock,
                                       Method... mockedMethods)

      Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
      Creates a mock object that implements the given class.
      Type Parameters:
        `T` - the class that the mock object should extend.
      Parameters:
        `toMock` - the class that the mock object should extend.
        `mockedMethods` - methods that will be mocked, other methods will behave normally
      Returns:
        the mock object.

    - #### createMock

          @Deprecated
          <T> T createMock(Class<T> toMock,
                                       ConstructorArgs constructorArgs,
                                       Method... mockedMethods)

      Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
      Creates a mock object that implements the given class.
      Type Parameters:
        `T` - the class that the mock object should extend.
      Parameters:
        `toMock` - the class that the mock object should extend.
        `constructorArgs` - constructor and parameters used to instantiate the mock.
        `mockedMethods` - methods that will be mocked, other methods will behave normally
      Returns:
        the mock object.

    - #### createMock

          @Deprecated
          <T> T createMock(String name,
                                       Class<T> toMock,
                                       Method... mockedMethods)

      Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
      Creates a mock object that implements the given class.
      Type Parameters:
        `T` - the class that the mock object should extend.
      Parameters:
        `name` - the name of the mock object.
        `toMock` - the class that the mock object should extend.
        `mockedMethods` - methods that will be mocked, other methods will behave normally
      Returns:
        the mock object.

    - #### createMock

          @Deprecated
          <T> T createMock(String name,
                                       Class<T> toMock,
                                       ConstructorArgs constructorArgs,
                                       Method... mockedMethods)

      Deprecated. Use `EasyMock.createMockBuilder(Class)` instead
      Creates a mock object that implements the given class.
      Type Parameters:
        `T` - the class that the mock object should extend.
      Parameters:
        `name` - the name of the mock object.
        `toMock` - the class that the mock object should extend.
        `constructorArgs` - constructor and parameters used to instantiate the mock.
        `mockedMethods` - methods that will be mocked, other methods will behave normally
      Returns:
        the mock object.

    - #### reset

          void reset()

      Removes all expectations for the mock objects of this control.

    - #### resetToNice

          void resetToNice()

      Removes all expectations for the mock objects of this control and turn them to nice mocks.

    - #### resetToDefault

          void resetToDefault()

      Removes all expectations for the mock objects of this control and turn them to default mocks.

    - #### resetToStrict

          void resetToStrict()

      Removes all expectations for the mock objects of this control and turn them to strict mocks.

    - #### replay

          void replay()

      Switches the control from record mode to replay mode.

    - #### verify

          void verify()

      Verifies that all expectations were met.

    - #### checkOrder

          void checkOrder(boolean state)

      Switches order checking on and off.
      Parameters:
        `state` - `true` switches order checking on, `false` switches it off.

    - #### makeThreadSafe

          void makeThreadSafe(boolean threadSafe)

      Makes the mock thread safe.
      Parameters:
        `threadSafe` - If the mock should be thread safe or not

    - #### checkIsUsedInOneThread

          void checkIsUsedInOneThread(boolean shouldBeUsedInOneThread)

      Check that the mock is called from only one thread
      Parameters:
        `shouldBeUsedInOneThread` - If it should be used in one thread only or not

Copyright © 2001–2015 EasyMock contributors. All rights reserved.