@Test void fromShouldAdaptMaxRetriesWhenUnderAttempts() throws Exception { DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(1, "1s,2*2s"); DelaysAndMaxRetry expected = new DelaysAndMaxRetry(3, ImmutableList.of(new Delay(1, Duration.ofSeconds(1)), new Delay(2, Duration.ofSeconds(2)))); assertThat(actual).isEqualTo(expected); }
public static DelaysAndMaxRetry from(int intendedMaxRetries, String delaysAsString) throws MessagingException { List<Delay> delayTimesList = createDelayList(delaysAsString); int totalAttempts = computeTotalAttempts(delayTimesList); return getDelaysAndMaxRetry(intendedMaxRetries, totalAttempts, delayTimesList); }
DelaysAndMaxRetry { public static DelaysAndMaxRetry from(int intendedMaxRetries, String delaysAsString) throws MessagingException { List<Delay> delayTimesList = createDelayList(delaysAsString); int totalAttempts = computeTotalAttempts(delayTimesList); return getDelaysAndMaxRetry(intendedMaxRetries, totalAttempts, delayTimesList); } }
DelaysAndMaxRetry { public static DelaysAndMaxRetry from(int intendedMaxRetries, String delaysAsString) throws MessagingException { List<Delay> delayTimesList = createDelayList(delaysAsString); int totalAttempts = computeTotalAttempts(delayTimesList); return getDelaysAndMaxRetry(intendedMaxRetries, totalAttempts, delayTimesList); } @VisibleForTesting  DelaysAndMaxRetry(int maxRetries, List<Delay> delays); }
DelaysAndMaxRetry { public static DelaysAndMaxRetry from(int intendedMaxRetries, String delaysAsString) throws MessagingException { List<Delay> delayTimesList = createDelayList(delaysAsString); int totalAttempts = computeTotalAttempts(delayTimesList); return getDelaysAndMaxRetry(intendedMaxRetries, totalAttempts, delayTimesList); } @VisibleForTesting  DelaysAndMaxRetry(int maxRetries, List<Delay> delays); static DelaysAndMaxRetry defaults(); static DelaysAndMaxRetry from(int intendedMaxRetries, String delaysAsString); int getMaxRetries(); ImmutableList<Duration> getExpandedDelays(); @Override boolean equals(Object o); @Override int hashCode(); }
DelaysAndMaxRetry { public static DelaysAndMaxRetry from(int intendedMaxRetries, String delaysAsString) throws MessagingException { List<Delay> delayTimesList = createDelayList(delaysAsString); int totalAttempts = computeTotalAttempts(delayTimesList); return getDelaysAndMaxRetry(intendedMaxRetries, totalAttempts, delayTimesList); } @VisibleForTesting  DelaysAndMaxRetry(int maxRetries, List<Delay> delays); static DelaysAndMaxRetry defaults(); static DelaysAndMaxRetry from(int intendedMaxRetries, String delaysAsString); int getMaxRetries(); ImmutableList<Duration> getExpandedDelays(); @Override boolean equals(Object o); @Override int hashCode();  }