I need some advices on how to mock a rest api. My application is in MVP architecture.
My interface for API:
public interface MyAPI {
@GET(\"{cmd
Thanks for @Ilya Tretyakov, I came out this solution:
private ArgumentCaptor> subscriberArgumentCaptor;
@Test
public void testLoginWithCorrectUserNameAndPassword() throws Exception {
mLoginPresenter.login("user@email.com","password");
// create the mock Response object
Response response = ......
verify(service, times(1)).login(
subscriberArgumentCaptor.capture(),
stringUserNameCaptor.capture(),
stringPasswordCaptor.capture()
);
subscriberArgumentCaptor.getValue().onNext(response);
verify(view).loginSuccess();
}