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