org.mockito
@Incubating public interface MockitoFramework
To get MockitoFramework
instance use Mockito.framework()
.
For more info on listeners see addListener(MockitoListener)
.
Modifier and Type | Method and Description |
---|---|
void |
addListener(MockitoListener listener)
Adds listener to Mockito.
|
void |
removeListener(MockitoListener listener)
When you add listener using
addListener(MockitoListener) make sure to remove it. |
@Incubating void addListener(MockitoListener listener)
MockitoListener
.
Listeners can be useful for engs that extend Mockito framework.
They are used in the implementation of unused stubbings warnings (MockitoHint
).
Make sure you remove the listener when the job is complete, see removeListener(MockitoListener)
.
Currently the listeners list is thread local so you need to remove listener from the same thread otherwise
remove is ineffectual.
In typical scenarios, it is not a problem, because adding & removing listeners typically happens in the same thread.
For usage examples, see Mockito codebase. If you have ideas and feature requests about Mockito listeners API we are very happy to hear about it via our issue tracker or mailing list.
Mockito.framework().addListener(myListener);
listener
- to add@Incubating void removeListener(MockitoListener listener)
addListener(MockitoListener)
make sure to remove it.
Currently the listeners list is thread local so you need to remove listener from the same thread otherwise
remove is ineffectual.
In typical scenarios, it is not a problem, because adding & removing listeners typically happens in the same thread.
For usage examples, see Mockito codebase. If you have ideas and feature requests about Mockito listeners API we are very happy to hear about it via our issue tracker or mailing list.
listener
- to remove