-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'kagkarlsson:master' into master
- Loading branch information
Showing
6 changed files
with
50 additions
and
11 deletions.
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
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
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
39 changes: 39 additions & 0 deletions
39
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,39 @@ | ||
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()); | ||
} | ||
|
||
@Test | ||
void test_default_priority_with_instance_builder() { | ||
RecurringTask<Void> task = | ||
Tasks.recurring("task", new Daily(LocalTime.MIDNIGHT)) | ||
.execute((taskInstance, executionContext) -> {}); | ||
|
||
assertEquals(task.getDefaultPriority(), task.instanceBuilder("id").build().getPriority()); | ||
} | ||
} |
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
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