File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
reactive/kotlinx-coroutines-rx1/src/test/kotlin/kotlinx/coroutines/experimental/rx1 Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,26 @@ class IntegrationTest(
9090 assertThat(cnt, IsEqual (1 ))
9191 }
9292
93+ @Test
94+ fun testObservableWithNull () = runBlocking<Unit > {
95+ val observable = rxObservable<String ?>(ctx(coroutineContext)) {
96+ if (delay) delay(1 )
97+ send(null )
98+ }
99+ assertThat(observable.awaitFirst(), IsNull ())
100+ assertThat(observable.awaitFirstOrDefault(" OK" ), IsNull ())
101+ assertThat(observable.awaitFirstOrNull(), IsNull ())
102+ assertThat(observable.awaitFirstOrElse { " OK" }, IsNull ())
103+ assertThat(observable.awaitLast(), IsNull ())
104+ assertThat(observable.awaitSingle(), IsNull ())
105+ var cnt = 0
106+ observable.consumeEach {
107+ assertThat(it, IsNull ())
108+ cnt++
109+ }
110+ assertThat(cnt, IsEqual (1 ))
111+ }
112+
93113 @Test
94114 fun testNumbers () = runBlocking<Unit > {
95115 val n = 100 * stressTestMultiplier
You can’t perform that action at this time.
0 commit comments