use of io.crate.testing.FailingBatchIterator in project crate by crate.
the class SingleBucketBuilderTest method testConsumeFailingBatchIterator.
@Test
public void testConsumeFailingBatchIterator() throws Exception {
FailingBatchIterator iterator = new FailingBatchIterator(TestingBatchIterators.range(0, 4), 2);
bucketBuilder.accept(iterator, null);
try {
bucketBuilder.completionFuture().get(10, TimeUnit.SECONDS);
fail("completionFuture must fail");
} catch (ExecutionException e) {
assertThat(e.getCause(), instanceOf(UnsupportedOperationException.class));
}
try {
iterator.moveNext();
fail("iterator must be closed");
} catch (IllegalStateException e) {
assertThat(e.getMessage(), is("Iterator is closed"));
}
}
Aggregations