### Question:
RetriableCommand { public T execute(Object... arguments) throws Exception { Exception latestException; int counter = 0; while (true) { try { return doExecute(arguments); } catch (Exception exception) { LOG.error("Failure in Retriable command: {}", description, exception); latestException = exception; } counter++; RetryAction action = retryPolicy.shouldRetry(latestException, counter, 0, true); if (action.action == RetryPolicy.RetryAction.RetryDecision.RETRY) { ThreadUtil.sleepAtLeastIgnoreInterrupts(action.delayMillis); } else { break; } } throw new IOException("Couldn't run retriable-command: " + description, latestException); } RetriableCommand(String description);  RetriableCommand(String description, RetryPolicy retryPolicy); T execute(Object... arguments); RetriableCommand<T> setRetryPolicy(RetryPolicy retryPolicy);  }### Answer:
@Test public void typical() { try { new MyRetriableCommand(5).execute(0); Assert.assertTrue(false); } catch (Exception e) { Assert.assertTrue(true); } try { new MyRetriableCommand(3).execute(0); Assert.assertTrue(true); } catch (Exception e) { Assert.assertTrue(false); } try { new MyRetriableCommand(5, RetryPolicies.retryUpToMaximumCountWithFixedSleep(5, 0, TimeUnit.MILLISECONDS)) .execute(0); Assert.assertTrue(true); } catch (Exception e) { Assert.assertTrue(false); } }