Assuming that with a class like:
public class A {
public void smth {
}
public void smth2 {
smth();
}
}
We spy it with mockito and make a simple call :
A spiedA = spy(new A());
spiedA.smth2();
After that when we want to retrieve call count:
Mockito.mockingDetails(spiedA).getInvocations().size()
And it returns two calls as expected. But i want to only register outside calls without inner delegations. Is there possibility to achieve the result i demand? If only Mockito.Invocation could provide with call stack i would filter it out.
Ok problem solved. Wrapped in java.lang.reflect.Proxy with custom invocation handler.