I am trying to mock a SimpleDateFormat
object but Mockito says I have the wrong number of args. Code:
SimpleDateFormat spyDateFormat = spy(new SimpleDateFormat(DateFormatManager.MAIN_ACTIVITY_TITLE_FORMAT));
// exception points to below line
when(spyDateFormat.format(any(Date.class))).thenReturn("foo format");
exception:
org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
3 matchers expected, 1 recorded:
The method exists in DateFormat, its parent:
http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html#format(java.util.Date)
Fiddled around with switching to DateFormat, using spy
. No luck.