When I\'m testing this static method
public class SomeClass {
public static long someMethod(Map map, String string, Long l, Log log) {
...
}
Better late than never, the line below:
Mockito.when(SomeClass.someMethod(anyMap(), anyString(), anyLong(),
isA(Log.class))).thenReturn(1L);
should be:
PowerMockito.when(SomeClass.someMethod(anyMap(), anyString(), anyLong(),
isA(Log.class))).thenReturn(1L);
So, instead of invoking Mockito.when
, one should invoke PowerMockito.when