public void testTimeSlotCalculus() throws Exception {
Throttler throttler = new Throttler(context, null, constant(3), 1000, null, false, false);
// calculate will assign a new slot
throttler.calculateDelay(new DefaultExchange(context));
TimeSlot slot = throttler.nextSlot();
// start a new time slot
assertNotNull(slot);
// make sure the same slot is used (3 exchanges per slot)
assertSame(slot, throttler.nextSlot());
assertTrue(slot.isFull());
assertTrue(slot.isActive());
TimeSlot next = throttler.nextSlot();
// now we should have a new slot that starts somewhere in the future
assertNotSame(slot, next);
assertFalse(next.isActive());
}