@Test
  public void testFractionOfRoot_tree_partial() {
    Allocation root = Allocation.newRoot("ignored", 10);
    Allocation left = root.newChild("ignored", 2);
    Allocation right = root.newChild("ignored", 4);
    Allocation leftDown = left.newChild("ignored", 20);
    Allocation rightLeft = right.newChild("ignored", 20);
    Allocation rightRight = right.newChild("ignored", 100);
    Allocation rightRightDown = rightRight.newChild("ignored", 200);

    Assert.assertEquals(1.0 / 10, root.getFractionOfRoot(), DOUBLE_ERROR_MARGIN);
    Assert.assertEquals(1.0 / 10 / 2, left.getFractionOfRoot(), DOUBLE_ERROR_MARGIN);
    Assert.assertEquals(1.0 / 10 / 4, right.getFractionOfRoot(), DOUBLE_ERROR_MARGIN);
    Assert.assertEquals(1.0 / 10 / 2 / 20, leftDown.getFractionOfRoot(), DOUBLE_ERROR_MARGIN);
    Assert.assertEquals(1.0 / 10 / 4 / 20, rightLeft.getFractionOfRoot(), DOUBLE_ERROR_MARGIN);
    Assert.assertEquals(1.0 / 10 / 4 / 100, rightRight.getFractionOfRoot(), DOUBLE_ERROR_MARGIN);
    Assert.assertEquals(
        1.0 / 10 / 4 / 100 / 200, rightRightDown.getFractionOfRoot(), DOUBLE_ERROR_MARGIN);
  }
Error margin for checking equality of two doubles.
jib-core/src/test/java/com/google/cloud/tools/jib/event/progress/AllocationTest.java