jeudi 25 décembre 2014

Mockito Matchers any Map

How can I use any map in mockito? I tried with following codes



when(mockedService.patch("1", Matchers.<Map<String, Object>>any())).thenReturn(object);


and with:



when(mockedService.patch("1", anyMap())).thenReturn(object);


But it returns:



org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
2 matchers expected, 1 recorded.


It works only when I put any(String.class):



when(mockedService.patch(any(String.class), Matchers.<Map<String, Object>>any())).thenReturn(object);


But I want to have option of puting actual values instead of any String


Aucun commentaire:

Enregistrer un commentaire