### Question:
RetryAdvice implements Ordered { @Around("org.ektorp.spring.RetryAdvice.retryableDbOperation()") public Object retryAfterUpdateConflict(ProceedingJoinPoint pjp) throws Throwable { int numAttempts = 0; UpdateConflictException conflictException; do { numAttempts++; try { log.debug("proceeding join point: {}", pjp.toShortString()); return pjp.proceed(); } catch (UpdateConflictException e) { log.warn("{} experienced update conflict. attempt: {}", pjp.toShortString(), numAttempts); conflictException = e; } } while (numAttempts < maxRetries); throw conflictException; }  @Pointcut("@annotation(org.ektorp.Retryable)") void retryableDbOperation(); @Around("org.ektorp.spring.RetryAdvice.retryableDbOperation()") Object retryAfterUpdateConflict(ProceedingJoinPoint pjp); int getOrder(); void setMaxRetries(int maxRetries);  }### Answer:
@Test public void testRetryAfterUpdateConflict() throws Throwable { RetryAdvice a = new RetryAdvice(); ProceedingJoinPoint jp = mock(ProceedingJoinPoint.class); when(jp.proceed()) .thenThrow(new UpdateConflictException("id","rev")) .thenReturn("result"); a.retryAfterUpdateConflict(jp); verify(jp, times(2)).proceed(); }
@Test public void testRetryAfterUpdateConflict2() throws Throwable { RetryAdvice a = new RetryAdvice(); ProceedingJoinPoint jp = mock(ProceedingJoinPoint.class); when(jp.proceed()).thenReturn("result"); a.retryAfterUpdateConflict(jp); verify(jp, times(1)).proceed(); }