-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
In Mockito 2.2.5 and later, when setting expectations for mocking a varargs method, using an array doesn't work:
Mockito.when(good.call(Mockito.any(String[].class))).thenReturn(1L);
And instead the contained type must be used:
Mockito.when(good.call(Mockito.any(String.class))).thenReturn(1L);
However in the face of an overload of the varargs method that takes a single argument (of the same type):
Long call(String value);
Long call(String... values);
This results in being unable to set an expectation for the varargs call.
This worked previously in Mockito 2.2.4 and earlier.
Reproducer: mockito-bug.tar.gz
mjustin and arulrajnet