@JsonIgnore
  void segregate(WorkflowRollupOverview rollup) {
    if (rollup == null) {
      return;
    }
    this.totalLeafCount -= rollup.totalLeafCount;
    if (rollup.overview == null) {
      return;
    }

    rollup.overview.forEach(
        (k, v) -> {
          Checks.notNull(
                  this.overview.get(k),
                  "Invalid: full overview should include the segregation rollup")
              .segregate(v);
          if (this.overview.get(k).cnt == 0) {
            this.overview.remove(k);
          }
        });
  }
@Test
  public void testSegregate() throws Exception {
    WorkflowRollupOverview overview =
        loadObject(
            "fixtures/instances/sample-workflow-rollup-overview.json",
            WorkflowRollupOverview.class);

    WorkflowRollupOverview.CountReference ref1 = new WorkflowRollupOverview.CountReference();
    ref1.setCnt(1);
    ref1.setRef(
        Collections.singletonMap(
            "maestro_foreach_inline_123:1", Collections.singletonList("5000:job.2:1")));
    WorkflowRollupOverview.CountReference ref2 = new WorkflowRollupOverview.CountReference();
    ref2.setCnt(1);
    Map<StepInstance.Status, WorkflowRollupOverview.CountReference> newOverview = new HashMap<>();
    newOverview.put(StepInstance.Status.RUNNING, ref1);
    newOverview.put(StepInstance.Status.INITIALIZED, ref2);

    overview.segregate(WorkflowRollupOverview.of(2, newOverview));

    assertEquals(10077, overview.getTotalLeafCount());
    assertEquals(66, overview.getOverview().get(StepInstance.Status.INITIALIZED).getCnt());
    assertEquals(26, overview.getOverview().get(StepInstance.Status.RUNNING).getCnt());
    assertFalse(
        overview
            .getOverview()
            .get(StepInstance.Status.RUNNING)
            .getRef()
            .get("maestro_foreach_inline_123:1")
            .remove("5000:job.2:1"));
  }