AbstractConnector connector = mock(AbstractConnector.class);
when(endpoint.getConnector()).thenReturn(connector);
RetryPolicyTemplate retryPolicyTemplate = mock(RetryPolicyTemplate.class);
when(endpoint.getRetryPolicyTemplate()).thenReturn(retryPolicyTemplate);
when(retryPolicyTemplate.execute(any(RetryCallback.class), any(WorkManager.class))).thenAnswer(
new Answer<Object>()
{
public Object answer(InvocationOnMock invocation) throws Throwable
{
RetryCallback retryCallback = (RetryCallback) invocation.getArguments()[0];