// now the semaphore's limit should be reached and the thread blocked
assertEquals("Wrong semaphore count", count - 1, semaphore
.getAcquireCount());
// this wakes up the thread, it should call the semaphore once more
semaphore.endOfPeriod();
t.join();
assertEquals("Wrong semaphore count (2)", 1, semaphore
.getAcquireCount());
assertEquals("Wrong acquire() count", count - 1, semaphore
.getLastAcquiresPerPeriod());