Polish ScheduledTaskRegistrar(Tests)
This commit is contained in:
parent
e24ebd6dbb
commit
fcd60b269e
|
|
@ -126,7 +126,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the trigger tasks as a list of {@link TriggerTask}
|
* Get the trigger tasks as an unmodifiable list of {@link TriggerTask} objects.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
public List<TriggerTask> getTriggerTaskList() {
|
public List<TriggerTask> getTriggerTaskList() {
|
||||||
|
|
@ -155,7 +155,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the cron tasks as a list of {@link CronTask}
|
* Get the cron tasks as an unmodifiable list of {@link CronTask} objects.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
public List<CronTask> getCronTaskList() {
|
public List<CronTask> getCronTaskList() {
|
||||||
|
|
@ -184,7 +184,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the fixed-rate tasks as a list of {@link IntervalTask}.
|
* Get the fixed-rate tasks as an unmodifiable list of {@link IntervalTask} objects.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
public List<IntervalTask> getFixedRateTaskList() {
|
public List<IntervalTask> getFixedRateTaskList() {
|
||||||
|
|
@ -213,7 +213,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the fixed-delay tasks as a list of {@link IntervalTask}
|
* Get the fixed-delay tasks as an unmodifiable list of {@link IntervalTask} objects.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
public List<IntervalTask> getFixedDelayTaskList() {
|
public List<IntervalTask> getFixedDelayTaskList() {
|
||||||
|
|
@ -259,11 +259,11 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Runnable task to be triggered at the given fixed-rate period.
|
* Add a {@code Runnable} task to be triggered at the given fixed-rate interval.
|
||||||
* @see TaskScheduler#scheduleAtFixedRate(Runnable, long)
|
* @see TaskScheduler#scheduleAtFixedRate(Runnable, long)
|
||||||
*/
|
*/
|
||||||
public void addFixedRateTask(Runnable task, long period) {
|
public void addFixedRateTask(Runnable task, long interval) {
|
||||||
this.addFixedRateTask(new IntervalTask(task, period, 0));
|
this.addFixedRateTask(new IntervalTask(task, interval, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,10 @@ import static org.junit.Assert.*;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Unit tests for {@link ScheduledTaskRegistrar}.
|
||||||
|
*
|
||||||
* @author Tobias Montagna-Hay
|
* @author Tobias Montagna-Hay
|
||||||
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
public class ScheduledTaskRegistrarTests {
|
public class ScheduledTaskRegistrarTests {
|
||||||
|
|
||||||
|
|
@ -52,7 +55,7 @@ public class ScheduledTaskRegistrarTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFixedRateTasks() {
|
public void getFixedRateTasks() {
|
||||||
IntervalTask mockFixedRateTask = mock(IntervalTask.class);
|
IntervalTask mockFixedRateTask = mock(IntervalTask.class);
|
||||||
List<IntervalTask> fixedRateTaskList = Collections.singletonList(mockFixedRateTask);
|
List<IntervalTask> fixedRateTaskList = Collections.singletonList(mockFixedRateTask);
|
||||||
this.taskRegistrar.setFixedRateTasksList(fixedRateTaskList);
|
this.taskRegistrar.setFixedRateTasksList(fixedRateTaskList);
|
||||||
|
|
@ -62,7 +65,7 @@ public class ScheduledTaskRegistrarTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFixedDelayTasks() {
|
public void getFixedDelayTasks() {
|
||||||
IntervalTask mockFixedDelayTask = mock(IntervalTask.class);
|
IntervalTask mockFixedDelayTask = mock(IntervalTask.class);
|
||||||
List<IntervalTask> fixedDelayTaskList = Collections.singletonList(mockFixedDelayTask);
|
List<IntervalTask> fixedDelayTaskList = Collections.singletonList(mockFixedDelayTask);
|
||||||
this.taskRegistrar.setFixedDelayTasksList(fixedDelayTaskList);
|
this.taskRegistrar.setFixedDelayTasksList(fixedDelayTaskList);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue