You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that TestObserver was changed to always delegate calls, by default to the EMPTY Observer.
However, the EMPTY Observer does not define onError, so any attempt to use TestObserver with an observable that's supposed to fail in a unit test crashes the test with a OnErrorNotImplementedException
I wonder why this change was done? It adds complexity and surprise to something that should be void of behavior (mocks should record things, not perform logic IMHO)
The text was updated successfully, but these errors were encountered:
I had a problem with this to when using the TestObserver to test errors.
I'm using mockito so I worked this around creating my TestObservers like this:
@SuppressWarnings("unchecked")
public static <T> TestObserver<T> createTestObserver()
{
Observer<T> delegate = mock(Observer.class);
return new TestObserver<T>(delegate);
}
I noticed that TestObserver was changed to always delegate calls, by default to the
EMPTY
Observer.However, the EMPTY Observer does not define
onError
, so any attempt to use TestObserver with an observable that's supposed to fail in a unit test crashes the test with aOnErrorNotImplementedException
I wonder why this change was done? It adds complexity and surprise to something that should be void of behavior (mocks should record things, not perform logic IMHO)
The text was updated successfully, but these errors were encountered: