@@ -24,14 +24,16 @@ import kotlinx.coroutines.flow.Flow
24
24
import kotlinx.coroutines.flow.flow
25
25
import kotlinx.coroutines.flow.toList
26
26
import kotlinx.coroutines.runBlocking
27
+ import kotlinx.reflect.lite.KClass
28
+ import kotlinx.reflect.lite.jvm.java
29
+ import kotlinx.reflect.lite.jvm.kotlin
27
30
import org.assertj.core.api.Assertions.assertThat
28
31
import org.junit.jupiter.api.Test
29
32
import org.reactivestreams.Publisher
30
33
import reactor.core.publisher.Flux
31
34
import reactor.core.publisher.Mono
32
35
import reactor.test.StepVerifier
33
36
import java.time.Duration
34
- import kotlin.reflect.KClass
35
37
36
38
@OptIn(DelicateCoroutinesApi ::class )
37
39
class KotlinReactiveAdapterRegistryTests {
@@ -41,15 +43,15 @@ class KotlinReactiveAdapterRegistryTests {
41
43
@Test
42
44
fun deferredToPublisher () {
43
45
val source = GlobalScope .async { 1 }
44
- val target: Publisher <Int > = getAdapter(Deferred ::class ).toPublisher(source)
46
+ val target: Publisher <Int > = getAdapter(( Deferred ::class .java).kotlin ).toPublisher(source)
45
47
assertThat(target).isInstanceOf(Mono ::class .java)
46
48
assertThat((target as Mono <Int >).block(Duration .ofMillis(1000 ))).isEqualTo(1 )
47
49
}
48
50
49
51
@Test
50
52
fun publisherToDeferred () {
51
53
val source = Mono .just(1 )
52
- val target = getAdapter(Deferred ::class ).fromPublisher(source)
54
+ val target = getAdapter(( Deferred ::class .java).kotlin ).fromPublisher(source)
53
55
assertThat(target).isInstanceOf(Deferred ::class .java)
54
56
assertThat(runBlocking { (target as Deferred <* >).await() }).isEqualTo(1 )
55
57
}
@@ -61,7 +63,7 @@ class KotlinReactiveAdapterRegistryTests {
61
63
emit(2 )
62
64
emit(3 )
63
65
}
64
- val target: Publisher <Int > = getAdapter(Flow ::class ).toPublisher(source)
66
+ val target: Publisher <Int > = getAdapter(( Flow ::class .java).kotlin ).toPublisher(source)
65
67
assertThat(target).isInstanceOf(Flux ::class .java)
66
68
StepVerifier .create(target)
67
69
.expectNext(1 )
@@ -73,7 +75,7 @@ class KotlinReactiveAdapterRegistryTests {
73
75
@Test
74
76
fun publisherToFlow () {
75
77
val source = Flux .just(1 , 2 , 3 )
76
- val target = getAdapter(Flow ::class ).fromPublisher(source)
78
+ val target = getAdapter(( Flow ::class .java).kotlin ).fromPublisher(source)
77
79
assertThat(target).isInstanceOf(Flow ::class .java)
78
80
assertThat(runBlocking { (target as Flow <* >).toList() }).contains(1 , 2 , 3 )
79
81
}
0 commit comments