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.rx2
6 
7 import io.reactivex.*
8 import kotlinx.coroutines.*
9 import kotlinx.coroutines.flow.*
10 import kotlinx.coroutines.reactive.*
11 import org.junit.Test
12 import kotlin.test.*
13 
14 class BackpressureTest : TestBase() {
15     @Test
<lambda>null16     fun testBackpressureDropDirect() = runTest {
17         expect(1)
18         Flowable.fromArray(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         Flowable.fromArray(1)
31             .onBackpressureDrop()
32             .asFlow()
33             .collect {
34                 assertEquals(1, it)
35                 expect(2)
36             }
37         finish(3)
38     }
39 }