@Test
public void testDefaulPolicyInterruptionAsync() throws IOException, InterruptedException,
TimeoutException, ExecutionException {
Future<Object> res = RetryPolicy.newBuilder()
.withRetryOnException(Exception.class, Integer.MAX_VALUE)
.buildAsync().submit(() -> {
throw new IOException();
});
try {
res.get(100, TimeUnit.MILLISECONDS);
Assert.fail();
} catch (TimeoutException tex) {
}
res.cancel(true);
Assert.assertTrue(res.isDone());
try {
res.get(100, TimeUnit.MILLISECONDS);
Assert.fail();
} catch (CancellationException ex) {
LOG.debug("exception detail ", ex);
Assert.assertThat(ex.getSuppressed(), Matchers.arrayWithSize(1));
}
}