Skip to content

Instantly share code, notes, and snippets.

@bangarharshit
Created March 21, 2017 14:35
Show Gist options
  • Save bangarharshit/e0dbc2436283e15e90996e6d22f2f560 to your computer and use it in GitHub Desktop.
Save bangarharshit/e0dbc2436283e15e90996e6d22f2f560 to your computer and use it in GitHub Desktop.
public static void main(String[] args) throws InterruptedException {
TestSubscriber<Integer> testSubscriber = TestSubscriber.create(5); // For testing backpressure
TestObserver<Integer> testObserver = TestObserver.create(); // For testing observable.
Flowable<Integer> integerFlowable = getListOfStudentsFlowable();
Observable<Integer> observable = getListOfStudents();
observable.subscribe(testObserver);
integerFlowable.subscribe(testSubscriber);
testObserver.assertValueCount(100);
testSubscriber.assertValueCount(5);
}
public static Observable<Integer> getListOfStudents() {
return Observable.range(0, 100);
}
public static Flowable<Integer> getListOfStudentsFlowable() {
return Flowable.range(0, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment