Hi,
Can we have such the functionality below "officially" part of Mockito? Maybe in
MockitoDebuggerImpl? It seems to be only way to attach an InvocationListener to
a mock *after* it has been created.
I find such a method useful when dealing with legacy code tested with mockito.
The place where the mock is created is not (easily) reachable to me.
public static void makeMockVerbose(Object mock) {
Factory factory = (Factory) mock;
MethodInterceptorFilter filter = (MethodInterceptorFilter) factory.getCallback(0);
InternalMockHandler<?> mockHandler = (InternalMockHandler<?>) filter.getHandler();
MockCreationSettings settings = mockHandler.getMockSettings();
settings.getInvocationListeners().add(new VerboseMockInvocationLogger());
}
Original issue reported on code.google.com by
ccrav...@gmail.comon 27 Mar 2015 at 9:53