Skip to content

Commit 1e0dc2a

Browse files
committed
resolve pom xml
1 parent 85cd6a1 commit 1e0dc2a

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

core-kotlin-modules/core-kotlin-concurrency-3/pom.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,30 @@
1515

1616
<properties>
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18-
<rxkotlin.version>2.3.0</rxkotlin.version>
18+
<rxkotlin.version>3.0.1</rxkotlin.version>
19+
<rxcoroutines.version>1.8.1</rxcoroutines.version>
20+
<junit.version>3.8.1</junit.version>
1921
</properties>
2022

2123
<dependencies>
2224
<dependency>
2325
<groupId>junit</groupId>
2426
<artifactId>junit</artifactId>
25-
<version>3.8.1</version>
26-
<scope>test</scope>
27+
<version>${junit.version}</version>
2728
</dependency>
2829

2930
<dependency>
3031
<groupId>io.reactivex.rxjava3</groupId>
3132
<artifactId>rxkotlin</artifactId>
32-
<version>3.0.1</version>
33+
<version>${rxkotlin.version}</version>
3334
</dependency>
3435

3536
<dependency>
3637
<groupId>org.jetbrains.kotlinx</groupId>
3738
<artifactId>kotlinx-coroutines-rx3</artifactId>
38-
<version>1.8.1</version>
39+
<version>${rxcoroutines.version}</version>
3940
</dependency>
4041
</dependencies>
42+
43+
4144
</project>

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,22 @@ class SingleRxJavaToCoroutineDeferredUnitTest {
4040

4141
@Test
4242
fun `using async and blockingGet`() = runBlocking {
43-
val deferred =
44-
async { getFilteredProducts().blockingGet() } // potentially blocking main thread while not careful
45-
deferred.assertOver500AndSorted() // assertion test
43+
val deferred = async { getFilteredProducts().blockingGet() }
44+
deferred.assertOver500AndSorted()
4645
}
4746

4847
@Test
4948
fun `using subscribe and CompletableDeferred`() = runBlocking {
5049
val deferred = CompletableDeferred<List<Product>>()
51-
getFilteredProducts().subscribe({ products ->
52-
deferred.complete(products)
53-
}, { error ->
54-
deferred.completeExceptionally(error)
55-
})
50+
getFilteredProducts().subscribe(deferred::complete, deferred::completeExceptionally)
5651
deferred.assertOver500AndSorted()
5752
}
5853

5954
@Test
6055
fun `using suspendCoroutines`(): Unit = runBlocking {
6156
val deferred = async {
6257
suspendCoroutine { continuation ->
63-
getFilteredProducts().subscribe { result ->
64-
continuation.resume(result)
65-
}
58+
getFilteredProducts().subscribe(continuation::resume, continuation::resumeWithException)
6659
}
6760
}
6861
deferred.assertOver500AndSorted()
@@ -72,11 +65,7 @@ class SingleRxJavaToCoroutineDeferredUnitTest {
7265
fun `using suspendCancellableCoroutine`(): Unit = runBlocking {
7366
val deferred = async {
7467
suspendCancellableCoroutine { continuation ->
75-
getFilteredProducts().subscribe({ result ->
76-
continuation.resume(result)
77-
}, { error ->
78-
continuation.resumeWithException(error)
79-
})
68+
getFilteredProducts().subscribe(continuation::resume, continuation::resumeWithException)
8069
}
8170
}
8271
deferred.assertOver500AndSorted()

0 commit comments

Comments
 (0)