@Test
public void testShouldTry() {
ExceptionHandler handler = new ExceptionHandler.Builder().retryOn(IOException.class).build();
assertTrue(handler.shouldRetry(new IOException()));
assertTrue(handler.shouldRetry(new ClosedByInterruptException()));
assertFalse(handler.shouldRetry(new RuntimeException()));
handler = new ExceptionHandler.Builder()
.retryOn(IOException.class, NullPointerException.class)
.abortOn(RuntimeException.class, ClosedByInterruptException.class,
InterruptedException.class)
.build();
assertTrue(handler.shouldRetry(new IOException()));
assertFalse(handler.shouldRetry(new ClosedByInterruptException()));
assertFalse(handler.shouldRetry(new InterruptedException()));
assertFalse(handler.shouldRetry(new RuntimeException()));
assertTrue(handler.shouldRetry(new NullPointerException()));
}