Issue
I need to write an Integration Test case . In the whole flow i do have a bean class which has a method. I want to write a test case case to check if that method was called in the test or not. How can i do that ? Any Suggestions ?
Solution
You can use the appropriate methods in Mockito
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
verify(mockObject, atLeast(2)).someMethod("was called at least twice");
verify(mockObject, times(1)).someMethod("was called exactly one time");
Answered By - Parth Manaktala
Answer Checked By - Mary Flores (JavaFixing Volunteer)