### Question:
RetryUtil { public static void retryAction(int maxRetries, RetryOperation operation) { Objects.requireNonNull(operation); int attempts = 0; boolean successful = false; Exception lastException = null; while (attempts < maxRetries && !successful) { attempts++; try { operation.operation(); successful = true; } catch (Exception e) { lastException = e; } } if (!successful) { if (lastException != null) { throw new OpenStorefrontRuntimeException("Failed to run operation after: " + maxRetries + " attempts", lastException); } } } private  RetryUtil(); static void retryAction(int maxRetries, RetryOperation operation);  }### Answer:
@Test public void testRetryAction() { LOG.info("retryAction"); LOG.info("Scenario 1: null operation"); try { RetryOperation operation = null; RetryUtil.retryAction(10, operation); Assert.fail("Should notsucceed"); } catch (NullPointerException ex) { } LOG.info("Scenario 2: operation 3 retries success"); int maxRetries = 3; RetryOperation operation = () -> { retriedCount++; if (retriedCount < maxRetries) { throw new RuntimeException("Fail"); } }; RetryUtil.retryAction(maxRetries, operation); LOG.info("Scenario 3: operation 3 retries fail"); operation = () -> { throw new RuntimeException("Fail"); }; try { RetryUtil.retryAction(maxRetries, operation); Assert.fail("Should not succeed"); } catch (OpenStorefrontRuntimeException ex) { System.out.println(ex.getErrorTypeCode()); System.out.println(ex.getLocalizedMessage()); System.out.println(ex.getPotentialResolution()); } }