when(queue.add(queueItem)).thenReturn(true);
when(queue.getHead()).thenReturn(queueItem);
ReplicationQueue errorQueue = mock(ReplicationQueue.class);
when(errorQueue.add(queueItem)).thenReturn(true);
when(queueProvider.getQueue("agentName", ErrorAwareQueueDistributionStrategy.ERROR_QUEUE_NAME)).thenReturn(errorQueue);
ReplicationQueueItemState state = mock(ReplicationQueueItemState.class);
when(state.isSuccessful()).thenReturn(false);
when(state.getAttempts()).thenReturn(2);
when(queue.getStatus(any(ReplicationQueueItem.class))).thenReturn(state);
boolean returnedState = errorAwareDistributionStrategy.add("agentName", replicationPackage, queueProvider);
assertFalse(returnedState);
}