@Test
public void testDeallocate() {

    final Allocations allocations = new Allocations(Lists.<Allocation>newArrayList());
    // 0123456789|0123456789|0123456789|0123456789|0123456789|0123456789
    // AAAAAAAAAA|BBBBBBBBBB|BBBBBBBBBB|CCCCCCCCCC|CCCCCCCCCC|CCCCCCCCCC
    allocations.allocate(control, 10);
    allocations.allocate(withLogin, 20);
    allocations.allocate(withoutLogin, 30);
    // 0123456789|0123456789|0123456789|0123456789|0123456789|0123456789
    //      AAAAA|          |BBBBBBBBBB|          |     CCCCC|CCCCCCCCCC
    allocations.deallocate(control, 5);
    allocations.deallocate(withLogin, 10);
    allocations.deallocate(withoutLogin, 15);
    assertEquals(
        "allocations should be smaller and within the same offset range",
        // deallocations are applied from left to right
        Lists.newArrayList(
            new Allocation(control, 5, 5),
            new Allocation(withLogin, 20, 10),
            new Allocation(withoutLogin, 45, 15)
        ),
        allocations.getAllocations()
    );
}