@Test
public void observerCheckTerminatedNonDelayErrorError() {

    TestObserver<Integer> to = new TestObserver<Integer>();
    to.onSubscribe(Disposables.empty());
    ObservableQueueDrain<Integer, Integer> qd = new ObservableQueueDrain<Integer, Integer>() {
        @Override
        public boolean cancelled() {
            return false;
        }
        @Override
        public boolean done() {
            return false;
        }
        @Override
        public Throwable error() {
            return new TestException();
        }
        @Override
        public boolean enter() {
            return true;
        }
        @Override
        public int leave(int m) {
            return 0;
        }
        @Override
        public void accept(Observer<? super Integer> a, Integer v) {
        }
    };
    SpscArrayQueue<Integer> q = new SpscArrayQueue<Integer>(32);
    QueueDrainHelper.checkTerminated(true, false, to, false, q, null, qd);
    to.assertFailure(TestException.class);
}