@Test
  public void testAccumulateProgress() {
    Consumer<ProgressEvent> progressEventConsumer =
        progressEvent -> {
          double fractionOfRoot = progressEvent.getAllocation().getFractionOfRoot();
          long units = progressEvent.getUnits();

          progress += units * fractionOfRoot;
        };

    EventHandlers eventHandlers = makeEventHandlers(progressEventConsumer);

    eventHandlers.dispatch(new ProgressEvent(AllocationTree.child1Child, 50));
    Assert.assertEquals(1.0 / 2 / 100 * 50, progress, DOUBLE_ERROR_MARGIN);

    eventHandlers.dispatch(new ProgressEvent(AllocationTree.child1Child, 50));
    Assert.assertEquals(1.0 / 2, progress, DOUBLE_ERROR_MARGIN);

    eventHandlers.dispatch(new ProgressEvent(AllocationTree.child2, 10));
    Assert.assertEquals(1.0 / 2 + 1.0 / 2 / 200 * 10, progress, DOUBLE_ERROR_MARGIN);

    eventHandlers.dispatch(new ProgressEvent(AllocationTree.child2, 190));
    Assert.assertEquals(1.0, progress, DOUBLE_ERROR_MARGIN);
  }
Second child of the root node.
jib-core/src/test/java/com/google/cloud/tools/jib/event/events/ProgressEventTest.java