Source:
public void subsequentStartupTest() throws Exception { requiredSwapSegmentsPerSize = 1; alloc = constructAllocator(); List<DiskSpaceRequirements> requirementsList = new ArrayList<>(); requirementsList.add(new DiskSpaceRequirements(5, 6, 0)); requirementsList.add(new DiskSpaceRequirements(3, 7, 0)); requirementsList.add(new DiskSpaceRequirements(5, 4, 0)); requirementsList.add(new DiskSpaceRequirements(6, 3, 1)); alloc.initializePool(requirementsList); verifyPoolState(new ExpectedStateBuilder().add(3, 8).add(5, 11).add(6, 3).build()); File f1 = allocateAndVerify("file1", 5); File f2 = allocateAndVerify("file2", 3); verifyPoolState(new ExpectedStateBuilder().add(3, 7).add(5, 10).add(6, 3).build()); alloc = constructAllocator(); verifyPoolState(new ExpectedStateBuilder().add(3, 7).add(5, 10).add(6, 3).build()); alloc.initializePool(requirementsList); verifyPoolState(new ExpectedStateBuilder().add(3, 8).add(5, 11).add(6, 3).build()); freeAndVerify(f1, 5); freeAndVerify(f2, 3); verifyPoolState(new ExpectedStateBuilder().add(3, 9).add(5, 12).add(6, 3).build()); alloc = constructAllocator(); f1 = allocateAndVerify("file1", 6); f2 = allocateAndVerify("file2", 6); verifyPoolState(new ExpectedStateBuilder().add(3, 9).add(5, 12).add(6, 1).build()); freeAndVerify(f1, 6); verifyPoolState(new ExpectedStateBuilder().add(3, 9).add(5, 12).add(6, 2).build()); requirementsList.clear(); requirementsList.add(new DiskSpaceRequirements(3, 20, 1)); requirementsList.add(new DiskSpaceRequirements(5, 6, 1)); alloc.initializePool(requirementsList); verifyPoolState(new ExpectedStateBuilder().add(3, 20).add(5, 6).build()); freeAndVerify(f2, 6); verifyPoolState(new ExpectedStateBuilder().add(3, 20).add(5, 6).add(6, 1).build()); }

Target:
public void subsequentStartupTest() throws Exception { requiredSwapSegmentsPerSize = 1; alloc = constructAllocator(); List<DiskSpaceRequirements> requirementsList = new ArrayList<>(); requirementsList.add(new DiskSpaceRequirements(5, 6, 0)); requirementsList.add(new DiskSpaceRequirements(3, 7, 0)); requirementsList.add(new DiskSpaceRequirements(5, 4, 0)); requirementsList.add(new DiskSpaceRequirements(6, 3, 1)); alloc.initializePool(requirementsList); verifyPoolState(new ExpectedState().add(3, 8).add(5, 11).add(6, 3)); File f1 = allocateAndVerify("file1", 5); File f2 = allocateAndVerify("file2", 3); verifyPoolState(new ExpectedState().add(3, 7).add(5, 10).add(6, 3)); alloc = constructAllocator(); verifyPoolState(new ExpectedState().add(3, 7).add(5, 10).add(6, 3)); alloc.initializePool(requirementsList); verifyPoolState(new ExpectedState().add(3, 8).add(5, 11).add(6, 3)); freeAndVerify(f1, 5); freeAndVerify(f2, 3); verifyPoolState(new ExpectedState().add(3, 9).add(5, 12).add(6, 3)); alloc = constructAllocator(); f1 = allocateAndVerify("file1", 6); f2 = allocateAndVerify("file2", 6); verifyPoolState(new ExpectedState().add(3, 9).add(5, 12).add(6, 1)); freeAndVerify(f1, 6); verifyPoolState(new ExpectedState().add(3, 9).add(5, 12).add(6, 1)); requirementsList.clear(); requirementsList.add(new DiskSpaceRequirements(3, 20, 1)); requirementsList.add(new DiskSpaceRequirements(5, 6, 1)); alloc.initializePool(requirementsList); verifyPoolState(new ExpectedState().add(3, 20).add(5, 6)); freeAndVerify(f2, 6); verifyPoolState(new ExpectedState().add(3, 20).add(5, 6).add(6, 1)); }