Allocations { public void clear() { allocations.clear(); rebuildAllocationTables(); } Allocations();  Allocations(Iterable<Allocation> allocations); Treatment getTreatment(int bin); void allocate(Treatment treatment, int size); void deallocate(Treatment treatment, int size); void reallocate(Treatment source, Treatment destination, int size); List<Allocation> getAllocations(); int getSize(); int getUnallocatedSize(); void clear(); static final int NUM_BINS; }
@Test public void testClear() { Treatment t1, t2; try { t1 = new Treatment("control"); t2 = new Treatment("other"); } catch (ValidationException e) { t1 = null; t2 = null; } final Allocations allocations = new Allocations(Lists.newArrayList( new Allocation(t1, 0, 5), new Allocation(t2, 5, 5) )); assertEquals(2, allocations.getAllocations().size()); assertEquals(10, allocations.getSize()); allocations.clear(); assertEquals(0, allocations.getAllocations().size()); assertEquals(0, allocations.getSize()); }