Created
January 5, 2017 19:57
-
-
Save exallium/3d63b204d8c005dd1bd973c81553a5df to your computer and use it in GitHub Desktop.
Infinite Rx Sequence Usage
This file contains hidden or 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 | |
| fun rx_infinite() { | |
| val testSub = TestSubscriber<Int>() | |
| var start = 0 | |
| fun inc(): Int { | |
| start += 1 | |
| return start | |
| } | |
| Observable.just(1).repeat().flatMap { | |
| Observable.just(inc()) | |
| }.take(4).subscribe(testSub) | |
| testSub.assertCompleted() | |
| testSub.assertValueCount(4) | |
| testSub.assertValues(1, 2, 3, 4) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment