Debian Codegraph @

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenTest.java

raw
1 /*
2 * Copyright (c) 2016-present, RxJava Contributors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is
10 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
11 * the License for the specific language governing permissions and limitations under the License.
12 */
13
14 package io.reactivex.rxjava3.internal.operators.completable;
15
16 import org.junit.Test;
17
18 import io.reactivex.rxjava3.core.*;
19 import io.reactivex.rxjava3.testsupport.TestHelper;
20
21 public class CompletableAndThenTest extends RxJavaTest {
22 @Test
23 public void andThenMaybeCompleteValue() {
24 Completable.complete()
25 .andThen(Maybe.just(1))
26 .test()
27 .assertResult(1);
28 }
29
30 @Test
31 public void andThenMaybeCompleteError() {
32 Completable.complete()
33 .andThen(Maybe.error(new RuntimeException("test")))
34 .to(TestHelper.testConsumer())
35 .assertNotComplete()
36 .assertNoValues()
37 .assertError(RuntimeException.class)
38 .assertErrorMessage("test");
39 }
40
41 @Test
42 public void andThenMaybeCompleteEmpty() {
43 Completable.complete()
44 .andThen(Maybe.empty())
45 .test()
46 .assertNoValues()
47 .assertNoErrors()
48 .assertComplete();
49 }
50
51 @Test
52 public void andThenMaybeError() {
53 Completable.error(new RuntimeException("bla"))
54 .andThen(Maybe.empty())
55 .to(TestHelper.testConsumer())
56 .assertNotComplete()
57 .assertNoValues()
58 .assertError(RuntimeException.class)
59 .assertErrorMessage("bla");
60 }
61 }