diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt index b6f28a4903..324cf1109b 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt @@ -60,7 +60,7 @@ class CoroutinesTest { //when runBlocking { - val promise = launch(CommonPool) { expensiveComputation(res) } + val promise = launch(Dispatchers.Default) { expensiveComputation(res) } res.add("Hello,") promise.join() } @@ -84,7 +84,7 @@ class CoroutinesTest { //when val jobs = List(numberOfCoroutines) { - launch(CommonPool) { + launch(Dispatchers.Default) { delay(1L) counter.incrementAndGet() } @@ -100,7 +100,7 @@ class CoroutinesTest { fun givenCancellableJob_whenRequestForCancel_thenShouldQuit() { runBlocking { //given - val job = launch(CommonPool) { + val job = launch(Dispatchers.Default) { while (isActive) { //println("is working") } @@ -134,8 +134,8 @@ class CoroutinesTest { val delay = 1000L val time = measureTimeMillis { //given - val one = async(CommonPool) { someExpensiveComputation(delay) } - val two = async(CommonPool) { someExpensiveComputation(delay) } + val one = async(Dispatchers.Default) { someExpensiveComputation(delay) } + val two = async(Dispatchers.Default) { someExpensiveComputation(delay) } //when runBlocking { @@ -155,8 +155,8 @@ class CoroutinesTest { val delay = 1000L val time = measureTimeMillis { //given - val one = async(CommonPool, CoroutineStart.LAZY) { someExpensiveComputation(delay) } - val two = async(CommonPool, CoroutineStart.LAZY) { someExpensiveComputation(delay) } + val one = async(Dispatchers.Default, CoroutineStart.LAZY) { someExpensiveComputation(delay) } + val two = async(Dispatchers.Default, CoroutineStart.LAZY) { someExpensiveComputation(delay) } //when runBlocking { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt index f87409253f..1f1609b06b 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt @@ -46,7 +46,6 @@ class CoroutineUnitTest { return@async "${Thread.currentThread()} has run." } - val result = deferred.await() println(result) }