I am using Otto EventBus in my Android app.
In my class, LoginNetworkOperationI detect various types of network connection errors, and I send different bus events for each of them, and the class is LoginPresenterregistered as a listener and certain methods are called when these events are fired.
My question is how (and should I) do a unit test, did I select LoginNetworkOperationthis event and LoginPresenterhandle it with Mockito?
I considered this question: unit tests of Guava EventBus , but it does not contain enough information, especially regarding implementation.
public class LoginNetworkOperation {
public void execute(String username, String password) {
try {
} catch (Exception e) {
bus.post(new ExceptionEvent(e));
}
}
}
public class LoginPresenter {
void onExceptionEvent(ExceptionEvent exceptionEvent) {
}
}
Also, should there be Subject Under Testand which should be the mocked object?
JUnit + Mockito + Robolectric Android Studio, -