Reputation: 11
I am using Mockito and PowerMock when needed. Right now I need to verify that a private method was called but it's void and I can't find any other questions.
Upvotes: 1
Views: 53
Reputation: 15622
How can I verify that a private method was called in my public method
You don't!
UnitTests verify the public observable behavior of the code under test.
The public observable behavior of the CUT includes the return values and the communication with its dependencies.
the use of private method is an implementation detail which you don't want to test since it may be changed during refactorings without changing the CUTs behavior.
Upvotes: 2