TransactionSupport implements Transaction { protected abstract void doCommit();  @Override final void begin(); @Override final void commit(); @Override final void rollback(); @Override boolean isActive(); @Override boolean allowRetry(final Exception cause); @Override void reason(final String reason); @Override String reason();  }
@Test public void retryLimitIsResetWhenReusingTX() throws Throwable { doThrow(new UncheckedIOException("oops", new IOException())).when(tx).doCommit(); try { txWrapper.proceedWithTransaction(tx); fail("Expected retry to eventually fail"); } catch (UncheckedIOException e) { assertThat(e.getMessage(), containsString("oops")); } doThrow(new UncheckedIOException("oops", new IOException())).doNothing().when(tx).doCommit(); txWrapper.proceedWithTransaction(tx); }