RetryHarness { public RetryHarness(Retryable retry, BackoffPolicy policy) { this.retry = retry; this.policy = policy; retry.setHarness(this); } RetryHarness(Retryable retry, BackoffPolicy policy);  RetryHarness(Retryable retry, BackoffPolicy policy, boolean throwOnFailure); Exception getLastException(); boolean attempt(); void doAbort();  }
@Test public void testRetryHarness() throws InterruptedException, Exception { Retryable retry = new Retryable() { int totaltries = 0; public boolean doTry() { totaltries++; if (totaltries < 3) { return false; } totaltries = 0; return true; } }; RetryHarness harness = new RetryHarness(retry, new FixedRetryPolicy(3)); Assert.assertTrue(harness.attempt()); harness = new RetryHarness(retry, new FixedRetryPolicy(1)); Assert.assertFalse(harness.attempt()); }