RunnerId implements Function<RunState, String> { @Override public String apply(RunState runState) { if (runState.state() == RunState.State.SUBMITTING) { return extractorFunction.apply(styxConfig.get()); } return runState.data().runnerId().orElseGet(() -> extractorFunction.apply(styxConfig.get())); } private  RunnerId(Supplier<StyxConfig> styxConfig,
                  Function<StyxConfig, String> extractorFunction); @Override String apply(RunState runState); static RunnerId dockerRunnerId(Supplier<StyxConfig> styxConfig); static RunnerId flyteRunnerId(Supplier<StyxConfig> styxConfig);  }
@Test @Parameters(method = "runnersId") public void testGetRunnerIdFromConfigSupplierWhenSubmitting(RunnerId runnerId, String id) { var runState = createRunState(State.SUBMITTING, STATE_DATA); assertThat(runnerId.apply(runState), is(id)); }
@Test @Parameters(method = "runnersId") public void testGetRunnerIdFromRunState(RunnerId runnerId, String id) { var runState = createRunState(State.SUBMITTED, STATE_DATA); assertThat(runnerId.apply(runState), is(TEST_RUNNER_ID)); }
@Test @Parameters(method = "runnersId") public void testGetRunnerIdFromConfigSupplier(RunnerId runnerId, String id) { var runState = createRunState(State.QUEUED, StateData.zero()); assertThat(runnerId.apply(runState), is(id)); }