private void addTerminalOne(WorkflowInstance.Status status, WorkflowRollupOverview overview) {
    if (stats == null) {
      stats = new EnumMap<>(WorkflowInstance.Status.class);
    }
    stats.put(status, stats.getOrDefault(status, 0L) + 1);

    if (this.rollup == null) {
      this.rollup = new WorkflowRollupOverview();
    }
    this.rollup.aggregate(overview);
  }
@Test
  public void testAddTerminalOne() throws Exception {
    ForeachStepOverview overview =
        loadObject(
            "fixtures/instances/sample-foreach-step-overview.json", ForeachStepOverview.class);
    WorkflowRollupOverview.CountReference ref = new WorkflowRollupOverview.CountReference();
    ref.setCnt(1);
    WorkflowRollupOverview rollupOverview =
        WorkflowRollupOverview.of(1, Collections.singletonMap(StepInstance.Status.SUCCEEDED, ref));
    overview.addOne(80333, WorkflowInstance.Status.SUCCEEDED, rollupOverview);
    assertEquals(singletonEnumMap(WorkflowInstance.Status.SUCCEEDED, 80154L), overview.getStats());

    assertEquals(160307, overview.getRollup().getTotalLeafCount());
    ref.setCnt(160307);
    assertEquals(
        singletonEnumMap(StepInstance.Status.SUCCEEDED, ref), overview.getRollup().getOverview());

    assertTrue(overview.statusExistInIterations(WorkflowInstance.Status.SUCCEEDED));
    assertFalse(overview.statusExistInIterations(WorkflowInstance.Status.FAILED));
    assertEquals(10116, overview.getRunningStatsCount(true));
    assertEquals(332, overview.getRunningStatsCount(false));
  }