Last active
June 28, 2017 03:17
-
-
Save deepakazad/0d1836a30b2885e71e42fb6185c62d78 to your computer and use it in GitHub Desktop.
RxJava: Flowable to Single
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testEmptyFlowableToSingle() { | |
Flowable.empty() | |
.flatMapSingle(o -> Single.just("result")) | |
.test() | |
.assertValueCount(0) | |
.assertNoErrors(); | |
//There should have been an error | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testFlowableToSingle() { | |
Flowable.just("item1", "item2") | |
.single("result") | |
.test() | |
.assertError(IllegalArgumentException.class) | |
.assertErrorMessage("Sequence contains more than one element!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment