Package com.nurkiewicz.asyncretry

Examples of com.nurkiewicz.asyncretry.AsyncRetryContext


  public void shouldExamineExceptionAndDecide() throws Exception {
    //given
    final RetryPolicy retryPolicy = new RetryPolicy().abortIf(t -> t.getMessage().contains("abort"));

    //when
    final boolean abort = retryPolicy.shouldContinue(new AsyncRetryContext(retryPolicy, 1, new RuntimeException("abort")));
    final boolean retry = retryPolicy.shouldContinue(new AsyncRetryContext(retryPolicy, 1, new RuntimeException("normal")));

    //then
    assertThat(abort).isFalse();
    assertThat(retry).isTrue();
  }
View Full Code Here


public class AbstractRetryPolicyTest extends AbstractBaseTestCase {

  private static final int ANY_RETRY = 7;

  protected boolean shouldRetryOn(RetryPolicy policy, Throwable lastThrowable) {
    return policy.shouldContinue(new AsyncRetryContext(policy, ANY_RETRY, lastThrowable));
  }
View Full Code Here

TOP

Related Classes of com.nurkiewicz.asyncretry.AsyncRetryContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.