@Test
public void shouldTransitionFlyteWorkflowIntoSubmitting() throws Exception {

  var workflow = Workflow.create("id", FLYTE_WORKFLOW_CONFIGURATION);
  var workflowState = WorkflowState.builder().enabled(true).build();
  var workflowWithState = WorkflowWithState.create(workflow, workflowState);
  var workflowInstance = WorkflowInstance.create(workflow.id(), "2016-03-14");
  var runState = RunState.create(workflowInstance,
      PREPARE,
      StateData.newBuilder().trigger(Trigger.natural()).build(),
      NOW,
      COUNTER);
  when(storage.workflowWithState(workflow.id())).thenReturn(Optional.of(workflowWithState));
  toTest.transitionInto(runState, eventRouter);
  verify(eventRouter).receive(eventCaptor.capture(), eq(COUNTER));
  var event = eventCaptor.getValue();
  event.accept(eventVisitor);
  verify(eventVisitor)
      .submit(workflowInstanceCaptor.capture(), executionDescriptionCaptor.capture(), executionIdCaptor.capture());
  assertThat(executionIdCaptor.getValue(), startsWith("styx-run-"));
  assertThat(executionDescriptionCaptor.getValue().flyteExecConf(),
      is(FLYTE_WORKFLOW_CONFIGURATION.flyteExecConf()));
  assertThat(executionDescriptionCaptor.getValue().commitSha(), isPresentAndIs(FLYTE_WORKFLOW_CONFIGURATION.commitSha().get()));
  assertThat(executionDescriptionCaptor.getValue().env(), is(FLYTE_WORKFLOW_CONFIGURATION.env()));
  assertThat(executionDescriptionCaptor.getValue().runningTimeout(), is(FLYTE_WORKFLOW_CONFIGURATION.runningTimeout()));
  assertThat(executionDescriptionCaptor.getValue().retryCondition(), is(FLYTE_WORKFLOW_CONFIGURATION.retryCondition()));
}