@Test
public void testOnNextAfterOnError() {

    TestObservable t = new TestObservable(null);
    Observable<String> st = Observable.create(synchronize(Observable.create(t)));
    @SuppressWarnings("unchecked")
    Observer<String> w = mock(Observer.class);
    @SuppressWarnings("unused")
    Subscription ws = st.subscribe(w);
    t.sendOnNext("one");
    t.sendOnError(new RuntimeException("bad"));
    t.sendOnNext("two");
    verify(w, times(1)).onNext("one");
    verify(w, times(1)).onError(any(Throwable.class));
    verify(w, Mockito.never()).onNext("two");
}