ScheduledRepetition extends AbstractRepetition implements Runnable, ProvidesAlias, ProvidesValidations { @Override public void configure(Config config) { super.configure(config); Repetitions.get().submitRegularTask(this, config.getDuration(FREQUENCY_CONFIG, TimeUnit.MILLISECONDS)); }  @Override void configure(Config config); @Override void configureStep(BatchStep step, String name); @Override void run(); @Override String getAlias(); @Override Validations getValidations();  }
@Test public void testRepeatStep() { Config config = ConfigUtils.configFromResource("/repetitions/repetitions-test-config.conf"); try { BatchStep step = new BatchStep("testRepetition"); step.configure(config.getConfig("steps.repeater")); Thread.sleep(20); Set<DataStep> steps = Repetitions.get().getAndClearRepeatingSteps(); assertTrue("Repeating steps should not be populated", steps.isEmpty()); for (int i = 0; i < 5; i++) { Thread.sleep(500); steps = Repetitions.get().getAndClearRepeatingSteps(); assertFalse("Repeating steps should be populated", steps.isEmpty()); assertEquals("Step should be called 'testRepetition'", "testRepetition", steps.iterator().next().getName()); steps = Repetitions.get().getAndClearRepeatingSteps(); assertTrue("Repeating steps should be empty", steps.isEmpty()); } } catch (Exception e) { fail(); } }