@Test
  public void testSmoke() {
    Consumer<ProgressEvent> progressEventConsumer =
        progressEvent -> {
          Allocation allocation = progressEvent.getAllocation();
          long units = progressEvent.getUnits();

          updateCompletionMap(allocation, units);
        };

    EventHandlers eventHandlers = makeEventHandlers(progressEventConsumer);

    eventHandlers.dispatch(new ProgressEvent(AllocationTree.child1Child, 50));

    Assert.assertEquals(1, allocationCompletionMap.size());
    Assert.assertEquals(50, allocationCompletionMap.get(AllocationTree.child1Child).longValue());

    eventHandlers.dispatch(new ProgressEvent(AllocationTree.child1Child, 50));

    Assert.assertEquals(3, allocationCompletionMap.size());
    Assert.assertEquals(100, allocationCompletionMap.get(AllocationTree.child1Child).longValue());
    Assert.assertEquals(1, allocationCompletionMap.get(AllocationTree.child1).longValue());
    Assert.assertEquals(1, allocationCompletionMap.get(AllocationTree.root).longValue());

    eventHandlers.dispatch(new ProgressEvent(AllocationTree.child2, 200));

    Assert.assertEquals(4, allocationCompletionMap.size());
    Assert.assertEquals(100, allocationCompletionMap.get(AllocationTree.child1Child).longValue());
    Assert.assertEquals(1, allocationCompletionMap.get(AllocationTree.child1).longValue());
    Assert.assertEquals(200, allocationCompletionMap.get(AllocationTree.child2).longValue());
    Assert.assertEquals(2, allocationCompletionMap.get(AllocationTree.root).longValue());
  }
Second child of the root node.
jib-core/src/test/java/com/google/cloud/tools/jib/event/events/ProgressEventTest.java