@Override
    public void onError(QueryException error) {
        assert error != null;
        done.compareAndSet(null, error);
    }
@Test
    public void when_doneWithErrorWhileWaiting_then_throw_async() {
        initProducer(false);
        assertThat(iterator.hasNext(0, SECONDS)).isEqualTo(TIMEOUT);
        producer.onError(QueryException.error("mock error"));
        assertThatThrownBy(() -> iterator.hasNext(0, SECONDS))
                .hasMessageContaining("mock error");
    }