I am trying to write a Junit test which will verify whether the following method is called:
public long executeRequest(@RequestCodes.Code.RequestAnnotation int requestCode, Object requestInformation, RequestListener requestListener) {
boolean success = false;
... do stuff ...
return success ? 1L : -1L;
}
in a test using:
Mockito.when(mockedRequest.executeRequest(Matchers.any(RequestCodes.Code.RequestAnnotation.class), Matchers.any(RequestWrapper.class), Matchers.any(RequestListener.class))).thenReturn(1L);
The RequestCodes.Code.RequestAnnotation class is a elementary indef interface using an int to identify the call to make using a switch. Pretty much like this.
Matchers.any(RequestCodes.Code.RequestAnnotation.class)
won't work here and I have tried Matchers.any()
, Matchers.anyInt()
, Matchers.isA(RequestCodes.Code.RequestAnnotation.getClass())
(as well as anything else that came to mind) with no success.
Any suggestions would be much appreciated.
Aucun commentaire:
Enregistrer un commentaire