use of cn.taketoday.retry.RetryOperations in project today-framework by TAKETODAY.
the class StatefulRetryOperationsInterceptorTests method testKeyGeneratorReturningNull.
@SuppressWarnings("unchecked")
@Test
public void testKeyGeneratorReturningNull() throws Throwable {
this.interceptor.setKeyGenerator(mock(MethodArgumentsKeyGenerator.class));
this.interceptor.setLabel("foo");
RetryOperations template = mock(RetryOperations.class);
this.interceptor.setRetryOperations(template);
MethodInvocation invocation = mock(MethodInvocation.class);
when(invocation.getArguments()).thenReturn(new Object[] { new Object() });
this.interceptor.invoke(invocation);
ArgumentCaptor<DefaultRetryState> captor = ArgumentCaptor.forClass(DefaultRetryState.class);
verify(template).execute(any(RetryCallback.class), any(RecoveryCallback.class), captor.capture());
assertNull(captor.getValue().getKey());
}
Aggregations