Skip to content

Commit 85cd6a1

Browse files
committed
ski
2 parents 37c2256 + 64bc8d7 commit 85cd6a1

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

core-kotlin-modules/core-kotlin-concurrency-3/src/test/java/com/baeldung/singlerxjavatocoroutinedeferred/SingleRxJavaToCoroutineDeferredUnitTest.kt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class SingleRxJavaToCoroutineDeferredUnitTest {
3232

3333
private suspend fun Deferred<*>.assertOver500AndSorted() {
3434
assertThat(this.await() as List<*>).containsExactly(
35-
Product(4, "Lenovo", 550.0), Product(2, "Oppo", 800.0), Product(1, "Samsung", 1200.0)
35+
Product(4, "Lenovo", 550.0),
36+
Product(2, "Oppo", 800.0),
37+
Product(1, "Samsung", 1200.0)
3638
)
3739
}
3840

@@ -44,20 +46,13 @@ class SingleRxJavaToCoroutineDeferredUnitTest {
4446
}
4547

4648
@Test
47-
fun `using subscribe and CompletableDeferred`(): Unit = runBlocking {
48-
// val deferred = CompletableDeferred<List<Product>>()
49-
// getFilteredProducts().subscribe({ products ->
50-
// deferred.complete(products)
51-
// }, { error ->
52-
// deferred.completeExceptionally(error)
53-
// })
54-
// deferred.assertOver500AndSorted()
49+
fun `using subscribe and CompletableDeferred`() = runBlocking {
5550
val deferred = CompletableDeferred<List<Product>>()
56-
// async {
57-
getFilteredProducts().subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe { products ->
58-
deferred.complete(products)
59-
}
60-
// }
51+
getFilteredProducts().subscribe({ products ->
52+
deferred.complete(products)
53+
}, { error ->
54+
deferred.completeExceptionally(error)
55+
})
6156
deferred.assertOver500AndSorted()
6257
}
6358

0 commit comments

Comments
 (0)