Search in sources :

Example 1 with FailingBatchIterator

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"));
    }
}
Also used : ExecutionException(java.util.concurrent.ExecutionException) FailingBatchIterator(io.crate.testing.FailingBatchIterator) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 FailingBatchIterator (io.crate.testing.FailingBatchIterator)1 ExecutionException (java.util.concurrent.ExecutionException)1 Test (org.junit.Test)1