@Test public void jobsWithEveryAnnotationShouldBeExecuted() throws Exception { EveryTestJob.results.clear(); jobManager.start(); Thread.sleep(5000); assertThat(EveryTestJob.results, hasSize(greaterThan(5))); }
@Test public void jobsOnStartupShouldBeExecuted() throws Exception { ApplicationStartTestJob.results.clear(); jobManager.start(); Thread.sleep(1000); assertThat(ApplicationStartTestJob.results, hasSize(1)); }
@Test public void jobsWithEveryAnnotationAndNoValueShouldBeExternallyConfigured() throws Exception { givenConfigurationFor("everyTestJobDefaultConfiguration", "1s"); EveryTestJobDefaultConfiguration.results.clear(); jobManager.start(); Thread.sleep(5000); assertThat(EveryTestJobDefaultConfiguration.results, hasSize(greaterThan(5))); }
@Test public void jobsOnStoppingShouldBeExecuted() throws Exception { ApplicationStopTestJob.results.clear(); jobManager.start(); jobManager.stop(); stopped = true; assertThat(ApplicationStopTestJob.results, hasSize(1)); }
@Test public void jobsWithEveryAnnotationAndDelayStartShouldWaitToBeExecuted() throws Exception { EveryTestJobWithDelay.results.clear(); jobManager.start(); Thread.sleep(2500); assertThat(EveryTestJobWithDelay.results, hasSize(0)); Thread.sleep(2500); assertThat(EveryTestJobWithDelay.results, hasSize(lessThan(4))); }