-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to test presenter ? #297
Comments
You have to provide a mock to the actual call at the use case method inside the presenter. |
I have followed the same as this test class UserListPresenterTest |
Hi @rcfgnu , Have you found anything wrong/missing in my code from UserListPresenterTest class? |
@devendroid as I understood, NPE appeared because Can you try the following to match types of the parameters in verify(setAddressUseCase)?.execute(
any(DisposableObserver.class),
any(Params.class)) Also try to remove |
Thanks, @epetrenko, to give the hint for NPE, I have resolved this, but now on verify execute method I'm getting this Exception:
Now my test class is:
|
@devendroid it happened because |
@epetrenko I have mocked the countSurveyUseCase using
|
@devendroid try to do the following instead of defining generic type: execute(any(DisposableObserver.class), any(Void.class)) |
@epetrenko It's not allowing in kotlin, forcing to convert like this Void::class.java . |
Hi,
I have implemented the same architecture in kotlin but when I'm mocking a UseCase class, it's not initializing, my presenter test class is below:
Getting the NullPointerException on
...domain.interactor.UseCase.execute(UseCase.kt:53)
my UseCase Class is:
Could you please help or advice on this?
The text was updated successfully, but these errors were encountered: