1 /* 2 * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines.reactor 6 7 import kotlinx.coroutines.* 8 import kotlinx.coroutines.flow.* 9 import kotlinx.coroutines.reactive.* 10 import org.junit.Test 11 import reactor.core.publisher.* 12 import kotlin.test.* 13 14 class BackpressureTest : TestBase() { 15 @Test <lambda>null16 fun testBackpressureDropDirect() = runTest { 17 expect(1) 18 Flux.fromArray(arrayOf(1)) 19 .onBackpressureDrop() 20 .collect { 21 assertEquals(1, it) 22 expect(2) 23 } 24 finish(3) 25 } 26 27 @Test <lambda>null28 fun testBackpressureDropFlow() = runTest { 29 expect(1) 30 Flux.fromArray(arrayOf(1)) 31 .onBackpressureDrop() 32 .asFlow() 33 .collect { 34 assertEquals(1, it) 35 expect(2) 36 } 37 finish(3) 38 } 39 }