@Test
public void testDefaulPolicyAsync() throws IOException, InterruptedException, TimeoutException {

  try (LogAssert expect = TestLoggers.sys().expect(PREDICATE_CLASS, Level.DEBUG, 2,
          LogMatchers.hasMatchingMessage(
            Matchers.startsWith("Result java.lang.RuntimeException, retrying org.spf4j.failsafe.RetryPolicyTest")))) {
    try {
      RetryPolicy.newBuilder()
            .withDefaultThrowableRetryPredicate()
            .withRetryOnException(Exception.class, 2) // will retry any other exception twice.
            .buildAsync().submit(() -> {
        throw new RuntimeException();
      }).get();
      Assert.fail();
    } catch (ExecutionException ex) {
      Assert.assertEquals(RuntimeException.class, ex.getCause().getClass());
      expect.assertObservation();
    }
  }
}