What I am trying to do is to print out the number of times that a certain method was called using Mockito.
When I do the following:
int counter =
Mockito.mockingDetails(myDependency)
.getInvocations()
.size();
System.out.println( counter );
it prints out all the methods invoked on the mock, however, I want to print out the counter for only one specific method, so if I try,
int counter =
Mockito.mockingDetails(myDependency.doSomething())
.getInvocations()
.size();
System.out.println( counter );
it occurs an error, saying that
Argument passed to Mockito.mockingDetails() should be a mock, but is null!
Does anyone know how to solve this problem? Thanks in advance!