-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: recurring tasks get correct default priority without data (#604)
- Loading branch information
1 parent
463b613
commit b0c5bb5
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
db-scheduler/src/test/java/com/github/kagkarlsson/scheduler/task/AbstractTaskTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.github.kagkarlsson.scheduler.task; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import com.github.kagkarlsson.scheduler.task.helper.RecurringTask; | ||
import com.github.kagkarlsson.scheduler.task.helper.Tasks; | ||
import com.github.kagkarlsson.scheduler.task.schedule.Daily; | ||
import java.time.LocalTime; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class AbstractTaskTest { | ||
|
||
@Test | ||
void test_default_priority_with_data() { | ||
RecurringTask<String> task = | ||
Tasks.recurring("task", new Daily(LocalTime.MIDNIGHT), String.class) | ||
.executeStateful((taskInstance, executionContext) -> ""); | ||
|
||
assertEquals(task.getDefaultPriority(), task.instance("id", "data").getPriority()); | ||
} | ||
|
||
@Test | ||
void test_default_priority_without_data() { | ||
RecurringTask<Void> task = | ||
Tasks.recurring("task", new Daily(LocalTime.MIDNIGHT)) | ||
.execute((taskInstance, executionContext) -> {}); | ||
|
||
assertEquals(task.getDefaultPriority(), task.instance("id").getPriority()); | ||
} | ||
} |