### Question:
MulSemaphore { public DALPermitsSet tryAcquire(BitSet ids) throws InterruptedException { return doTryAcquire(ids, 0); } MulSemaphore(int maxSemaphoreNumber); synchronized void unregister(int id); int availablePermits(int id); void putPermits(int id, int permits, int decimalPermits); DALPermitsSet tryAcquire(BitSet ids); DALPermitsSet overdrawAcquire(BitSet ids); DALPermitsSet tryAcquire(long time, TimeUnit timeUnit, BitSet ids); DALPermitsSet acquire(BitSet ids); DALPermitsSet newDALPermitsSet(); @Override String toString(); String getInfo(BitSet ids);  }### Answer:
@Test public void tryAcquire() throws InterruptedException { final MulSemaphore ms = new MulSemaphore(0x20); BitSet bitset = new BitSet(0x20); bitset.set(0, 2); ms.putPermits(0, 1, 0); ms.putPermits(1, 1, 0); Assert.assertEquals(ms.availablePermits(0), 1); final List<DALPermitsSet> dalPermits = new ArrayList<>(); dalPermits.add(ms.tryAcquire(bitset)); Assert.assertEquals(dalPermits.size(), 1); long start = System.currentTimeMillis(); Assert.assertTrue(ms.tryAcquire(20, TimeUnit.MILLISECONDS, bitset).getIds().isEmpty()); long dur = System.currentTimeMillis() - start; Assert.assertTrue(dur >= 20); }