@Test
public void testExecuteRetriableApplicationException() {

    AtomicInteger executeInvoked = new AtomicInteger(0);
    doAnswer((Answer<Map<String, Object>>) invocation -> {
        executeInvoked.incrementAndGet();
        throw new ApplicationException(ApplicationException.Code.BACKEND_ERROR, "some retriable error");
    }).when(actionProcessor).execute(any(), any(), any(), any());
    SimpleEventProcessor eventProcessor = new SimpleEventProcessor(executionService, metadataService, actionProcessor, eventQueues, jsonUtils, new TestConfiguration(), objectMapper);
    EventExecution eventExecution = new EventExecution("id", "messageId");
    eventExecution.setStatus(EventExecution.Status.IN_PROGRESS);
    eventExecution.setEvent("event");
    Action action = new Action();
    action.setAction(Type.start_workflow);
    eventProcessor.execute(eventExecution, action, "payload");
    assertEquals(3, executeInvoked.get());
    assertNull(eventExecution.getOutput().get("exception"));
}