@Test
public void testEmitFlyteEventsExceptionHandling() throws IsClosedException {

  doThrow(new IsClosedException())
      .when(stateManager).receive(Event.terminate(WORKFLOW_INSTANCE, Optional.of(SUCCESS_EXIT_CODE)));
  assertThrows(
      IsClosedException.class,
      () -> flyteRunner.emitFlyteEvents(ExecutionOuterClass.Execution.newBuilder().setClosure(
          ExecutionOuterClass.ExecutionClosure.newBuilder().setPhase(
              Execution.WorkflowExecution.Phase.SUCCEEDED).build()).build(), RUN_STATE));
}