### Question:
RetryerUtils { public static Boolean retryCall(final Callable<Boolean> callable, boolean checkResult) throws ExecutionException, RetryException { return getDefaultRetryer(checkResult).call(callable); } private  RetryerUtils(); static Retryer<Boolean> getDefaultRetryer(boolean checkResult); static Retryer<Boolean> getDefaultRetryer(); static Boolean retryCall(final Callable<Boolean> callable, boolean checkResult); static Boolean retryCall(final Callable<Boolean> callable); static boolean retryCallSilent(final Callable<Boolean> callable, boolean checkResult); static boolean retryCallSilent(final Callable<Boolean> callable);  }### Answer:
@Test public void testRecallResultCheck() { try { for (int execTarget = 1; execTarget <= 3; execTarget++) { int finalExecTarget = execTarget; int[] execTime = {0}; boolean result = RetryerUtils.retryCall(() -> { execTime[0]++; return execTime[0] == finalExecTarget; }); Assert.assertEquals(finalExecTarget, execTime[0]); Assert.assertTrue(result); } } catch (ExecutionException | RetryException e) { Assert.fail("Retry call failed " + e.getMessage()); } int[] execTime = {0}; try { RetryerUtils.retryCall(() -> { execTime[0]++; return execTime[0] == 4; }); Assert.fail("Recall times not reached"); } catch (RetryException e) { Assert.assertEquals(3, e.getNumberOfFailedAttempts()); Assert.assertEquals(3, execTime[0]); } catch (ExecutionException e) { Assert.fail("Retry call failed " + e.getMessage()); } }
@Test public void testRecallResultCheckWithPara() { try { for (int execTarget = 1; execTarget <= 3; execTarget++) { int finalExecTarget = execTarget; int[] execTime = {0}; boolean result = RetryerUtils.retryCall(() -> { execTime[0]++; return execTime[0] == finalExecTarget; }, true); Assert.assertEquals(finalExecTarget, execTime[0]); Assert.assertTrue(result); } } catch (ExecutionException | RetryException e) { Assert.fail("Retry call failed " + e.getMessage()); } int[] execTime = {0}; try { RetryerUtils.retryCall(() -> { execTime[0]++; return execTime[0] == 4; }, true); Assert.fail("Recall times not reached"); } catch (RetryException e) { Assert.assertEquals(3, e.getNumberOfFailedAttempts()); Assert.assertEquals(3, execTime[0]); } catch (ExecutionException e) { Assert.fail("Retry call failed " + e.getMessage()); } }
@Test public void testRecallResultNoCheck() { try { for (int execTarget = 1; execTarget <= 5; execTarget++) { int[] execTime = {0}; boolean result = RetryerUtils.retryCall(() -> { execTime[0]++; return execTime[0] > 1; }, false); Assert.assertEquals(1, execTime[0]); Assert.assertFalse(result); } } catch (ExecutionException | RetryException e) { Assert.fail("Retry call failed " + e.getMessage()); } }