CapacityManager { public void release() { release(1); } CapacityManager(final int maxCapacity); boolean acquire(); boolean acquire(int capacity); void release(); void release(int capacity); int consumedCapacity(); int availableCapacity();  }
@Test public void release() { CapacityManager mgr = new CapacityManager(10); mgr.acquire(10); mgr.release(); Assert.assertEquals(mgr.availableCapacity(), 1); Assert.assertEquals(mgr.consumedCapacity(), 9); mgr.release(50); Assert.assertEquals(mgr.availableCapacity(), 10); Assert.assertEquals(mgr.consumedCapacity(), 0); }