org.mockito.configuration
public interface IMockitoConfiguration
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
Modifier and Type | Method and Description |
---|---|
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<Object> |
getDefaultAnswer()
Allows configuring the default answers of unstubbed invocations
|
Answer<Object> getDefaultAnswer()
See javadoc for IMockitoConfiguration
AnnotationEngine getAnnotationEngine()
See javadoc for IMockitoConfiguration
boolean cleansStackTrace()
See javadoc for IMockitoConfiguration
boolean enableClassCache()