@Test
public void testStop() {

  long c = 0L;
  List<SequenceEvent> events = List.of(
      SequenceEvent.create(E.triggerExecution(UNKNOWN_TRIGGER0), c++, ts("07:55")),
      SequenceEvent.create(E.dequeue(RESOURCE_IDS), c++, ts("07:55")),
      SequenceEvent.create(E.submit(dockerDesc("img1", "sha1"), "exec-id-00"), c++, ts("07:55")),
      SequenceEvent.create(E.runError("First failure"), c++, ts("07:58")),
      SequenceEvent.create(E.retryAfter(10), c++, ts("07:59")),
      SequenceEvent.create(E.retry(), c++, ts("08:56")),
      SequenceEvent.create(E.submit(dockerDesc("img2", "sha2"), "exec-id-01"), c++, ts("08:55")),
      SequenceEvent.create(E.submitted("exec-id-01"), c++, ts("08:56")),
      SequenceEvent.create(E.started(), c++, ts("08:57")),
      SequenceEvent.create(E.runError("Second failure"), c++, ts("08:59")),
      SequenceEvent.create(E.stop(), c++, ts("08:59"))
  );
  assertValidTransitionSequence(events);
  WorkflowInstanceExecutionData workflowInstanceExecutionData =
      new WFIExecutionBuilder().executionInfo(events);
  WorkflowInstanceExecutionData expected =
      WorkflowInstanceExecutionData.create(
          WORKFLOW_INSTANCE,
          List.of(
              Trigger.create(
                  "trig0",
                  time("07:55"),
                  TriggerParameters.zero(),
                  true,
                  List.of(
                      Execution.create(
                          Optional.of("exec-id-00"),
                          Optional.of("img1"),
                          Optional.of("sha1"),
                          Optional.empty(),
                          List.of(
                              ExecStatus.create(time("07:58"), "FAILED", Optional.of("First failure"))
                          )
                      ),
                      Execution.create(
                          Optional.of("exec-id-01"),
                          Optional.of("img2"),
                          Optional.of("sha2"),
                          Optional.of(TEST_RUNNER_ID),
                          List.of(
                              ExecStatus.create(time("08:56"), "SUBMITTED", Optional.empty()),
                              ExecStatus.create(time("08:57"), "STARTED", Optional.empty()),
                              ExecStatus.create(time("08:59"), "FAILED", Optional.of("Second failure"))
                          )
                      )
                  )
              )
          )
      );
  assertThat(workflowInstanceExecutionData, is(expected));
}