@Test
@Parameters(method = "parametersForTestTransitionPollingToTerminateExitCodes")
public void testTransitionSubmittedToTerminateExitCodes(Execution.WorkflowExecution.Phase phase, String flyteExitCode,
                                               int exitCode) throws Exception {

  when(flyteAdminClient.getExecution("flyte-test", "testing", "execution-name")).thenReturn(
      ExecutionOuterClass.Execution
          .newBuilder()
          .setClosure(ExecutionOuterClass.ExecutionClosure.newBuilder().setError(
              Execution.ExecutionError
                  .newBuilder()
                  .setCode(flyteExitCode)
                  .build())
              .setPhase(phase).build())
          .build());
  flyteRunner.poll(FLYTE_EXECUTION_ID, RUN_STATE_SUBMITTED);
  verify(stateManager, timeout(60_000)).receive(Event.started(WORKFLOW_INSTANCE));
  verify(stateManager,  timeout(60_000)).receive(Event.terminate(WORKFLOW_INSTANCE, Optional.of(exitCode)));
}