I'm testing a component which wraps a Quartz Scheduler object.
My problem is that Quartz is doing some asynchronous processing internally and I can't write in my test code something like this:
Mockito.when(configurationMock.getId()).thenReturn(CONFIG_ID); target.addJob(configurationMock); Scheduler sched = (Scheduler) Whitebox.getInternalState(target, "scheduler"); assertTrue(sched.checkExists(new JobKey(configurationMock.getId()))); because it is possible that when I check the job's existence it is not there yet.
I checked the JUnit API but there is no assertWithTimeout() or something like that. Did I miss something?