final Semaphore semaphore = new Semaphore(1);
assertThat("semaphore begins with single permit",
semaphore.availablePermits(), is(1));
semaphore.acquire(1);
assertThat("semaphore has no available permits",
semaphore.availablePermits(), is(0));
new PermitReleasingCallback<>(semaphore).call(new Object());
assertThat("callback releases a permit",
semaphore.availablePermits(), is(1));
}
}