So, let's say I need to write a ClassA test that has a ClassB member, and I'm mocking ClassB .
At the end of the test, I would like to use verify(..) and verifyNoMoreInteractions(..) to set the behavior and validation for all mock calls.
Let's say that the layout has more than 10 interactions with different methods.
Is there a way to get JUnit to print all layout interactions and then use it in code?
Now I am just reading the code and looking for calls, and not writing the verification string in the test. I am sure there is an easier way (TDD will not be possible in my situation :))
My use case: I have a class with an algorithm that uses many other classes that I mock up. Adding a new method that calls many other methods, I would like to make sure that only x the number of methods has been called several times as the code works. This will make sure that someone will change something in the future, for example, by mistake, calling the method 5 times instead of 4, then the test will fail.
source share