@JsonIgnore
  public void enrich(WorkflowInstance instance) {
    if (instance.getCreateTime() != null) {
      timelineEvents.add(
          TimelineStatusEvent.create(instance.getCreateTime(), WorkflowInstance.Status.CREATED));
    }
    if (instance.getStartTime() != null) {
      timelineEvents.add(
          TimelineStatusEvent.create(instance.getStartTime(), WorkflowInstance.Status.IN_PROGRESS));
    }
    if (instance.getEndTime() != null) {
      timelineEvents.add(TimelineStatusEvent.create(instance.getEndTime(), instance.getStatus()));
    }
    Collections.sort(timelineEvents);
  }
@Test
  public void testGetEnrichedStepInstance() throws Exception {
    StepInstance instance =
        loadObject("fixtures/instances/sample-step-instance-succeeded.json", StepInstance.class);
    Timeline timeline = instance.getTimeline();
    timeline.enrich(instance);

    assertEquals(12, instance.getTimeline().getTimelineEvents().size());
    assertEquals(
        TimelineStatusEvent.create(1608749932076L, "CREATED"),
        instance.getTimeline().getTimelineEvents().get(0));
    assertEquals(
        TimelineStatusEvent.create(1608749932078L, "INITIALIZED"),
        instance.getTimeline().getTimelineEvents().get(1));
    assertEquals(
        TimelineStatusEvent.create(1608749932079L, "PAUSED"),
        instance.getTimeline().getTimelineEvents().get(2));
    assertEquals(
        TimelineStatusEvent.create(1608749934142L, "WAITING_FOR_SIGNALS"),
        instance.getTimeline().getTimelineEvents().get(3));
    assertEquals(
        TimelineStatusEvent.create(1608749934142L, "EVALUATING_PARAMS"),
        instance.getTimeline().getTimelineEvents().get(4));
    assertEquals(
        TimelineStatusEvent.create(1608749934142L, "WAITING_FOR_PERMITS"),
        instance.getTimeline().getTimelineEvents().get(5));
    assertEquals(
        TimelineStatusEvent.create(1608749934142L, "STARTING"),
        instance.getTimeline().getTimelineEvents().get(6));
    assertEquals(
        TimelineStatusEvent.create(1608749934147L, "RUNNING"),
        instance.getTimeline().getTimelineEvents().get(7));
    assertEquals(
        TimelineStatusEvent.create(1608749950263L, "FINISHING"),
        instance.getTimeline().getTimelineEvents().get(8));
    assertEquals(
        TimelineStatusEvent.create(1608749950263L, "SUCCEEDED"),
        instance.getTimeline().getTimelineEvents().get(9));
    assertEquals("hello world", instance.getTimeline().getTimelineEvents().get(10).getMessage());
    assertEquals(
        "sample error details", instance.getTimeline().getTimelineEvents().get(11).getMessage());
  }