FlyteEventTranslator { static List<Event> translate(ExecutionOuterClass.Execution execution, RunState runState) { final Execution.WorkflowExecution.Phase phase = execution.getClosure().getPhase(); final FlytePhase flytePhase = FlytePhase.fromProto(phase); if (isExited(flytePhase)) { return handleExited(execution, runState, flytePhase); } if (isStarted(flytePhase)) { return handleStarted(flytePhase, runState); } return List.of(); } private  FlyteEventTranslator();   }
@Test @Parameters(method = "parametersForTestTransitionPollingToTerminateExitCodes") public void runningToTerminateExitCodes(Execution.WorkflowExecution.Phase phase, String flyteExitCode, int exitCode){ var execution = createExecutionExitCodes(phase, flyteExitCode); when(runState.state()).thenReturn(RunState.State.RUNNING); when(runState.workflowInstance()).thenReturn(WFI); var events = translate(execution, runState); var expectedEvents = List.of(Event.terminate(WFI, Optional.of(exitCode))); assertEquals(events, expectedEvents); }