I am testing a function which would involve static method. so I am using powermock and mockito.
the original static method takes 3 arguments:
RSAHelper.RSADecrypt(AppHelper.getApplicationContext(), LibUtil.getDecryptionKeyName(), Base64.decode(encryptedData, Base64.DEFAULT));
so I am using
when(RSAHelper.RSADecrypt(any(), any(), eq(Base64.decode(GOOD_ENCRYPTION_STRING, Base64.DEFAULT)))).thenReturn(userData);
but this causes:
org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers! 3 matchers expected, 1 recorded:
and when I am using
when(RSAHelper.RSADecrypt(any(), any(), any())).thenReturn(userData)
and this works, but I just want to return different value based on third parameter. Since I already use matchers for all three parameters, I dont know where I was wrong is use the first way of impelemtation. need help. thanks