public void triggerNextSuperstep() {
        synchronized (monitor) {
            if (terminated) {
                throw new IllegalStateException("Already terminated.");
            }
            superstepNumber++;
            monitor.notifyAll();
        }
    }
@Test
    public void testWaitAlreadyFulfilled() {
        try {
            SuperstepKickoffLatch latch = new SuperstepKickoffLatch();
            latch.triggerNextSuperstep();

            Waiter w = new Waiter(latch, 2);
            Thread waiter = new Thread(w);
            waiter.setDaemon(true);
            waiter.start();

            WatchDog wd = new WatchDog(waiter, 2000);
            wd.start();

            Thread.sleep(100);

            wd.join();
            if (wd.getError() != null) {
                throw wd.getError();
            }

            if (w.getError() != null) {
                throw w.getError();
            }
        } catch (Throwable t) {
            t.printStackTrace();
            Assert.fail("Error: " + t.getMessage());
        }
    }