PowerMockito: got InvalidUseOfMatchersException when use matchers mocking static method
问题 When I'm testing this static method public class SomeClass { public static long someMethod(Map map, String string, Long l, Log log) { ... } } with import org.apache.commons.logging.Log; @RunWith(PowerMockRunner.class) //@PrepareForTest(SomeClass.class) public class Tests { @Test public void test() { ... PowerMockito.mockStatic(SomeClass.class); Mockito.when(SomeClass.someMethod(anyMap(), anyString(), anyLong(), isA(Log.class))).thenReturn(1L); ... } } I got InvalidUseOfMatchersException . My