Ok, I think I found the answer, but it was a headache. Rudy gave me the final hint with using using a spy, but it was still not trivial (although the solution looks "baby-easy"). Here is the complete solution:
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.times;
import static org.powermock.api.mockito.PowerMockito.verifyPrivate;
import static org.powermock.api.mockito.PowerMockito.doNothing;
import static org.powermock.api.mockito.PowerMockito.spy;
@RunWith(PowerMockRunner.class)
@PrepareForTest(Factory.class)
public class Tests extends TestCase {
public void testFactory() throws Exception {
Factory factorySpy = spy(new Factory());
String s = factorySpy.factorObject();
doNothing().when(factorySpy, "checkString", anyString());
verifyPrivate(factorySpy, times(1)).invoke("checkString", anyString());
}
}