@Test
public void testWaitForNextBuild() throws InterruptedException, CruiseControlException {

    projectConfig.add(new MockSchedule());
    MockProject mockProject = new MockProject() {
        private static final long serialVersionUID = 4262693344992901684L;
        public void run() {
            loop();
        }
        void checkWait() throws InterruptedException {
            waitForNextBuild();
        }
    };
    mockProject.overrideBuildInterval(1000);
    mockProject.setProjectConfig(projectConfig);
    mockProject.init();
    new Thread(mockProject).start();
    Thread.sleep(100);
    assertEquals(1, mockProject.getLoopCount());
    Thread.sleep(100);
    assertEquals(1, mockProject.getLoopCount());
    mockProject.forceBuild();
    Thread.sleep(100);
    assertEquals(2, mockProject.getLoopCount());
    mockProject.stopLooping();
}