Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (36 sloc) 1.12 KB
package samples.geo.tuputils
import org.junit.jupiter.api.Test
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import reactor.kotlin.core.util.function.component1
import reactor.kotlin.core.util.function.component2
import reactor.test.StepVerifier
class TupUtilsKotlinTest {
@Test
fun testZipWithoutTupUtils() {
val flux: Flux<String> = Mono.zip(Mono.just("a"), Mono.just(2))
.flatMapMany { tup ->
val s = tup.t1
val count = tup.t2
Flux.range(1, count)
.map { i: Int -> s + i }
}
StepVerifier
.create(flux)
.expectNext("a1")
.expectNext("a2")
.verifyComplete()
}
@Test
fun testZipWithDestructuring() {
val flux: Flux<String> = Mono.zip(Mono.just("a"), Mono.just(2))
.flatMapMany { (s: String, count: Int) ->
Flux.range(1, count).map { i: Int -> s + i }
}
StepVerifier
.create(flux)
.expectNext("a1")
.expectNext("a2")
.verifyComplete()
}
}
You can’t perform that action at this time.