@Test
public void testCompoundSemaphore() throws InterruptedException, TimeoutException {

  try (RateLimiter rateLimiter = new RateLimiter(1, Duration.ofSeconds(1), 2)) {
    CompoundSemaphore sem = new CompoundSemaphore(rateLimiter.toSemaphore(), new LocalSemaphore(2, false));
    sem.acquire(2, 4, TimeUnit.SECONDS);
    sem.release(2);
    sem.acquire(2, 4, TimeUnit.SECONDS);
    sem.release(2);
    sem.acquire(2, 4, TimeUnit.SECONDS);
    sem.release(2);
    Assert.assertEquals(2, sem.getSemaphores().length); // more assertions needed this is a cheat.
  }
}