public interface InlineMockMaker extends MockMaker
MockMakerfor mock makers that changes inline method implementations and need keep track of created mock objects.
Mockito's default inline mock maker keeps track of created mock objects via weak reference map.
This poses a risk of memory leaks in certain scenarios
There is no clean way to tackle those problems at the moment.
InlineMockMaker interface exposes methods to explicitly clear mock references.
Those methods are called by
When the user encounters a leak, he can mitigate the problem with
InlineMockMaker is for expert users and framework integrators, when custom inline mock maker is in use.
If you have a custom
MockMaker that keeps track of mock objects,
please have your mock maker implement
This way, it can participate in
|Modifier and Type||Method and Description|
Cleans up internal state for all existing mocks.
Clean up internal state for specified
void clearMock(Object mock)
mock. You may assume there won't be any interaction to the specific mock after this is called.
mock- the mock instance whose internal state is to be cleaned.