| 42 | import io.reactivex.rxjava3.testsupport.*; |
| 43 | |
| 44 | public class MaybeTest extends RxJavaTest { |
| 45 | @Test |
| 46 | public void fromFlowableEmpty() { |
| 47 | |
| 48 | Flowable.empty() |
| 49 | .singleElement() |
| 50 | .test() |
| 51 | .assertResult(); |
| 52 | } |
| 53 | |
| 54 | @Test |
| 55 | public void fromFlowableJust() { |
| 56 | |
| 57 | Flowable.just(1) |
| 58 | .singleElement() |
| 59 | .test() |
| 60 | .assertResult(1); |
| 61 | } |
| 62 | |
| 63 | @Test |
| 64 | public void fromFlowableError() { |
| 65 | |
| 66 | Flowable.error(new TestException()) |
| 67 | .singleElement() |
| 68 | .test() |
| 69 | .assertFailure(TestException.class); |
| 70 | } |
| 71 | |
| 72 | @Test |
| 73 | public void fromFlowableValueAndError() { |
| 74 | Flowable.just(1).concatWith(Flowable.<Integer>error(new TestException())) |
| 75 | .singleElement() |
| 76 | .test() |
| 77 | .assertFailure(TestException.class); |
| 78 | } |
| 79 | |
| 80 | @Test |
| 81 | public void fromFlowableMany() { |
| 82 | |
| 83 | Flowable.range(1, 2) |
| 84 | .singleElement() |
| 85 | .test() |
| 86 | .assertFailure(IllegalArgumentException.class); |
| 87 | } |
| 88 | |
| 89 | @Test |
| 90 | public void fromFlowableDisposeComposesThrough() { |
| 91 | PublishProcessor<Integer> pp = PublishProcessor.create(); |
| 92 | |
| 93 | TestObserver<Integer> to = pp.singleElement().test(); |
| 94 | |
| 95 | assertTrue(pp.hasSubscribers()); |
| 96 | |
| 97 | to.dispose(); |
| 98 | |
| 99 | assertFalse(pp.hasSubscribers()); |
| 100 | } |
| 101 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…