Skip to content

Commit

Permalink
fix: avoid "The Publisher returned by the supplier is null" exception (
Browse files Browse the repository at this point in the history
…#983)

Fixes #953

Co-authored-by: Lars Bilger <lars.bilger@lht.dlh.de>
  • Loading branch information
lbilger and Lars Bilger authored Apr 26, 2024
1 parent eaa3d63 commit 4b41d8d
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import java.time.Clock
import java.time.Duration
import java.time.Instant
import java.time.ZoneOffset
import java.util.*

internal class TaskChangeTrackerTest {
private val taskRepository: TaskRepository = mock()
Expand Down Expand Up @@ -224,6 +223,7 @@ internal class TaskChangeTrackerTest {

@Test
fun `schedules job for deleting leftover tasks`() {
publisherForResumeToken(null)
properties = properties.copy(
changeStream = properties.changeStream.copy(
clearDeletedTasks = properties.changeStream.clearDeletedTasks.copy(
Expand All @@ -246,11 +246,11 @@ internal class TaskChangeTrackerTest {
taskChangeTracker.initCleanupJob()
verify(scheduler).schedule(deleteRunnableCaptor.capture(), triggerCaptor.capture())
val trigger = triggerCaptor.firstValue
assertThat(trigger.nextExecutionTime(SimpleTriggerContext(Clock.fixed(Instant.EPOCH, ZoneOffset.UTC)).apply {
assertThat(trigger.nextExecution(SimpleTriggerContext(Clock.fixed(Instant.EPOCH, ZoneOffset.UTC)).apply {
update(
Date.from(Instant.EPOCH.minus(Duration.ofHours(24))),
Date.from(Instant.EPOCH.minus(Duration.ofHours(24))),
Date.from(Instant.EPOCH.minus(Duration.ofHours(23)))
Instant.EPOCH.minus(Duration.ofHours(24)),
Instant.EPOCH.minus(Duration.ofHours(24)),
Instant.EPOCH.minus(Duration.ofHours(23))
)
})).isBetween(Instant.EPOCH, Instant.EPOCH.plus(Duration.ofHours(1)))
deleteRunnableCaptor.firstValue.run()
Expand Down Expand Up @@ -287,6 +287,9 @@ internal class TaskChangeTrackerTest {
null,
null,
null,
null,
null,
null,
null
), TaskDocument::class.java, converter
)
Expand Down

0 comments on commit 4b41d8d

Please sign in to comment.