ClassifierSimpleRetryPolicy extends SimpleRetryPolicy { @Override public boolean canRetry(RetryContext context) { Throwable t = context.getLastThrowable(); return (t == null || classify(t)) && context.getRetryCount() < getMaxAttempts(); } ClassifierSimpleRetryPolicy();  ClassifierSimpleRetryPolicy(int maxAttempts);  ClassifierSimpleRetryPolicy(Classifier<Throwable, Boolean> classifier);  ClassifierSimpleRetryPolicy(int maxAttempts, Classifier<Throwable, Boolean> classifier); Classifier<Throwable, Boolean> getClassifier(); @Override boolean canRetry(RetryContext context);  }
@Test public void test_classify_nullClassifier() { RetryContext context = Mockito.mock(RetryContext.class); ClassifierSimpleRetryPolicy policy = new ClassifierSimpleRetryPolicy(null); Mockito.when(context.getLastThrowable()).thenReturn(new RuntimeException()); Assert.assertFalse(policy.canRetry(context)); }
@Test public void test_classify_nullClassifier2() { RetryContext context = Mockito.mock(RetryContext.class); ClassifierSimpleRetryPolicy policy = new ClassifierSimpleRetryPolicy(); Mockito.when(context.getLastThrowable()).thenReturn(new RuntimeException()); Assert.assertFalse(policy.canRetry(context)); }
@Test public void test_classify_nullClassifier3() { RetryContext context = Mockito.mock(RetryContext.class); ClassifierSimpleRetryPolicy policy = new ClassifierSimpleRetryPolicy(4); Mockito.when(context.getLastThrowable()).thenReturn(new RuntimeException()); Assert.assertFalse(policy.canRetry(context)); }