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

## org.mockito.configuration
Interface IMockitoConfiguration

All Known Implementing Classes:
  DefaultMockitoConfiguration, GlobalConfiguration

    public interface IMockitoConfiguration

Use it to configure Mockito. For now there are not many configuration options but it may change in future.

In most cases you don't really need to configure Mockito. For example in case of working with legacy code, when you might want to have different 'mocking style' this interface might be helpful. A reason of configuring Mockito might be if you disagree with the `ReturnsEmptyValues` unstubbed mocks return.

To configure Mockito create exactly org.mockito.configuration.MockitoConfiguration class that implements this interface.

Configuring Mockito is completely optional - nothing happens if there isn't any org.mockito.configuration.MockitoConfiguration on the classpath.

org.mockito.configuration.MockitoConfiguration must implement IMockitoConfiguration or extend `DefaultMockitoConfiguration`

Mockito will store single instance of org.mockito.configuration.MockitoConfiguration per thread (using ThreadLocal). For sanity of your tests, don't make the implementation stateful.

If you have comments on Mockito configuration feature don't hesitate to write to mockito@googlegroups.com

Method Summary
`boolean` | `cleansStackTrace()` This should be turned on unless you're a Mockito developer and you wish to have verbose (read: messy) stack traces that only few understand (eg: Mockito developers)
`boolean` | `enableClassCache()` Allow objenesis to cache classes.
`AnnotationEngine` | `getAnnotationEngine()` Configures annotations for mocks
`Answer<java.lang.Object>` | `getDefaultAnswer()` Allows configuring the default answers of unstubbed invocations
`ReturnValues` | `getReturnValues()` Deprecated. Please use `getDefaultAnswer()` Steps: 1. Leave the implementation of getReturnValues() method empty - it's not going to be used anyway. 2. Implement getDefaultAnswer() instead. In rare cases your code might not compile with recent deprecation & changes. Very sorry for inconvenience but it had to be done in order to keep framework consistent. See javadoc `ReturnValues` for info why this method was deprecated Allows configuring the default return values of unstubbed invocations See javadoc for `IMockitoConfiguration`

Method Detail

### getReturnValues

    @Deprecated
    ReturnValues getReturnValues()

  Deprecated. Please use `getDefaultAnswer()`

  Steps:

  1. Leave the implementation of getReturnValues() method empty - it's not going to be used anyway.

  2. Implement getDefaultAnswer() instead.

  In rare cases your code might not compile with recent deprecation & changes. Very sorry for inconvenience but it had to be done in order to keep framework consistent.

  See javadoc `ReturnValues` for info why this method was deprecated

  Allows configuring the default return values of unstubbed invocations

  See javadoc for `IMockitoConfiguration`

### getDefaultAnswer

    Answer<java.lang.Object> getDefaultAnswer()

  Allows configuring the default answers of unstubbed invocations

  See javadoc for `IMockitoConfiguration`

### getAnnotationEngine

    AnnotationEngine getAnnotationEngine()

  Configures annotations for mocks

  See javadoc for `IMockitoConfiguration`

### cleansStackTrace

    boolean cleansStackTrace()

  This should be turned on unless you're a Mockito developer and you wish to have verbose (read: messy) stack traces that only few understand (eg: Mockito developers)

  See javadoc for `IMockitoConfiguration`

  Returns:
    if Mockito should clean stack traces

### enableClassCache

    boolean enableClassCache()

  Allow objenesis to cache classes. If you're in an environment where classes are dynamically reloaded, you can disable this to avoid classcast exceptions.

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