Skip to content

Commit a1fb238

Browse files
committed
milliseconds
1 parent 89959b7 commit a1fb238

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core-kotlin-modules/core-kotlin-concurrency-3/src/test/java/com/baeldung/schedulingrepeatingtask/SchedulingRepeatingTaskUnitTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.junit.jupiter.api.Assertions.assertEquals
99
import org.junit.jupiter.api.Test
1010
import org.junit.jupiter.api.assertThrows
1111
import kotlin.time.Duration.Companion.milliseconds
12+
import kotlin.time.Duration.Companion.seconds
1213

1314
class SchedulingRepeatingTaskUnitTest {
1415

@@ -18,7 +19,7 @@ class SchedulingRepeatingTaskUnitTest {
1819
repeat(10) {
1920
count++
2021
println("Timer ticked! $count")
21-
delay(1000)
22+
delay(1000.milliseconds)
2223
}
2324

2425
assertEquals(10, count)
@@ -27,7 +28,7 @@ class SchedulingRepeatingTaskUnitTest {
2728
@Test
2829
fun `using withTimeout`(): Unit = runBlocking {
2930
assertThrows<TimeoutCancellationException> {
30-
withTimeout(5000) {
31+
withTimeout(5000.milliseconds) {
3132
while (true) {
3233
println("Waiting for timeout")
3334
delay(1000.milliseconds)

0 commit comments

Comments
 (0)