@Override
  public State cancel() throws IOException {
    State state = delegate.cancel();
    this.terminalMetrics = delegate.metrics();
    this.terminalState = state;
    this.cancel.run();
    return state;
  }
@Test
  public void givenTerminated_cancelIsNoop_reportsTerminalState() throws IOException {
    PipelineResult delegate = mock(PipelineResult.class);
    when(delegate.cancel()).thenReturn(PipelineResult.State.FAILED);
    PrismPipelineResult underTest = new PrismPipelineResult(delegate, exec::stop);
    assertThat(underTest.cancel()).isEqualTo(PipelineResult.State.FAILED);
  }