@SuppressFBWarnings("NP_NULL_ON_SOME_PATH")
  public void updateForUpstream(String workflowId, long instanceId, @Nullable String stepId) {
    Checks.checkTrue(
        restartConfig != null
            && !ObjectHelper.isCollectionEmptyOrNull(restartConfig.getRestartPath()),
        "Cannot update restart info in empty restart configuration for initiator [%s]",
        initiator);
    restartConfig
        .getRestartPath()
        .add(new RestartConfig.RestartNode(workflowId, instanceId, stepId));
    // Use RESTART_FROM_SPECIFIC (same in updateForDownstreamIfNeeded) along the restart path
    this.currentPolicy = RunPolicy.RESTART_FROM_SPECIFIC;
  }
@Test
  public void testUpdateForUpstream() {
    RestartConfig config = RestartConfig.builder().addRestartNode("foo", 1, "bar").build();
    RunRequest runRequest =
        RunRequest.builder()
            .initiator(new ManualInitiator())
            .currentPolicy(RunPolicy.RESTART_FROM_INCOMPLETE)
            .restartConfig(config)
            .build();
    runRequest.updateForUpstream("parent", 2, "sub-step");
    Assert.assertEquals("[parent][2]", runRequest.getWorkflowIdentity());
    Assert.assertEquals("sub-step", runRequest.getRestartStepId());
    Assert.assertEquals(RunPolicy.RESTART_FROM_SPECIFIC, runRequest.getCurrentPolicy());
  }