Skip to content

Commit fcd60b2

Browse files
committed
Polish ScheduledTaskRegistrar(Tests)
1 parent e24ebd6 commit fcd60b2

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

spring-context/src/main/java/org/springframework/scheduling/config/ScheduledTaskRegistrar.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void setTriggerTasksList(List<TriggerTask> triggerTasks) {
126126
}
127127

128128
/**
129-
* Return the trigger tasks as a list of {@link TriggerTask}
129+
* Get the trigger tasks as an unmodifiable list of {@link TriggerTask} objects.
130130
* @since 4.2
131131
*/
132132
public List<TriggerTask> getTriggerTaskList() {
@@ -155,7 +155,7 @@ public void setCronTasksList(List<CronTask> cronTasks) {
155155
}
156156

157157
/**
158-
* Return the cron tasks as a list of {@link CronTask}
158+
* Get the cron tasks as an unmodifiable list of {@link CronTask} objects.
159159
* @since 4.2
160160
*/
161161
public List<CronTask> getCronTaskList() {
@@ -184,7 +184,7 @@ public void setFixedRateTasksList(List<IntervalTask> fixedRateTasks) {
184184
}
185185

186186
/**
187-
* Return the fixed-rate tasks as a list of {@link IntervalTask}.
187+
* Get the fixed-rate tasks as an unmodifiable list of {@link IntervalTask} objects.
188188
* @since 4.2
189189
*/
190190
public List<IntervalTask> getFixedRateTaskList() {
@@ -213,7 +213,7 @@ public void setFixedDelayTasksList(List<IntervalTask> fixedDelayTasks) {
213213
}
214214

215215
/**
216-
* Return the fixed-delay tasks as a list of {@link IntervalTask}
216+
* Get the fixed-delay tasks as an unmodifiable list of {@link IntervalTask} objects.
217217
* @since 4.2
218218
*/
219219
public List<IntervalTask> getFixedDelayTaskList() {
@@ -259,11 +259,11 @@ public void addCronTask(CronTask task) {
259259
}
260260

261261
/**
262-
* Add a Runnable task to be triggered at the given fixed-rate period.
262+
* Add a {@code Runnable} task to be triggered at the given fixed-rate interval.
263263
* @see TaskScheduler#scheduleAtFixedRate(Runnable, long)
264264
*/
265-
public void addFixedRateTask(Runnable task, long period) {
266-
this.addFixedRateTask(new IntervalTask(task, period, 0));
265+
public void addFixedRateTask(Runnable task, long interval) {
266+
this.addFixedRateTask(new IntervalTask(task, interval, 0));
267267
}
268268

269269
/**

spring-context/src/test/java/org/springframework/scheduling/config/ScheduledTaskRegistrarTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
import static org.mockito.Mockito.*;
2626

2727
/**
28+
* Unit tests for {@link ScheduledTaskRegistrar}.
29+
*
2830
* @author Tobias Montagna-Hay
31+
* @since 4.2
2932
*/
3033
public class ScheduledTaskRegistrarTests {
3134

@@ -52,7 +55,7 @@ public void getCronTasks() {
5255
}
5356

5457
@Test
55-
public void testGetFixedRateTasks() {
58+
public void getFixedRateTasks() {
5659
IntervalTask mockFixedRateTask = mock(IntervalTask.class);
5760
List<IntervalTask> fixedRateTaskList = Collections.singletonList(mockFixedRateTask);
5861
this.taskRegistrar.setFixedRateTasksList(fixedRateTaskList);
@@ -62,7 +65,7 @@ public void testGetFixedRateTasks() {
6265
}
6366

6467
@Test
65-
public void testGetFixedDelayTasks() {
68+
public void getFixedDelayTasks() {
6669
IntervalTask mockFixedDelayTask = mock(IntervalTask.class);
6770
List<IntervalTask> fixedDelayTaskList = Collections.singletonList(mockFixedDelayTask);
6871
this.taskRegistrar.setFixedDelayTasksList(fixedDelayTaskList);

0 commit comments

Comments
 (0)