The Mockito and PowerMockito libraries for JUnit4 are not always the most intuitive.
Following is an example of how to spy and verify a static void method.
@Test
public void testAdd() {
// Prepare the Utils class to be spied.
PowerMockito.spy(Utils.class);
// Run the test and get the actual value from the OUT
int actualValue = App.add("Test1", 1, 1);
/*
* To verify the number of times that we called Utils.doSomething we
* first need to tell the PowerMockito library
→ Continue reading “How To Spy and Verify a Static Void Method in Java”