0

I'm trying to mock an exception and then returning it. But i'm having this error which i have no idea:

type="org.mockito.exceptions.misusing.InvalidUseOfMatchersException" org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers! 2 matchers expected, 4 recorded

My code is:

TitanException e = Mockito.mock(TitanException.class); long bankId = 111L, productId = 220L, subproductId = 333L; icctr009.execute(bankId, productId, subproductId); when(icctr009.titanQueryForListMap(anyString(), anyString(), anyString(), anyMap())) .thenThrow(e); 
6
  • Does stackoverflow.com/questions/16458136/… answer your question? Commented Oct 31, 2022 at 11:54
  • @Reporter Sorry, but i dont understand yet Commented Oct 31, 2022 at 11:58
  • Have you read this question? Commented Oct 31, 2022 at 12:00
  • Yes, i have tried when(icctr009.titanQueryForListMap(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyMap())) .thenThrow(e); but its not working Commented Oct 31, 2022 at 12:04
  • 2
    can you show your titanQueryForListMap method? Commented Oct 31, 2022 at 13:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.