Skip to content

Instantly share code, notes, and snippets.

@BartoszJarocki
Created May 14, 2017 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BartoszJarocki/80ecd01c5e0ad30df5ad7b8cf322711b to your computer and use it in GitHub Desktop.
Save BartoszJarocki/80ecd01c5e0ad30df5ad7b8cf322711b to your computer and use it in GitHub Desktop.
private void registerRxJavaIdlingResources() {
RxIdlingResource rxIdlingResource = new RxIdlingResource();
RxJavaHooks.setOnObservableStart((observable, onSubscribe) -> {
rxIdlingResource.incrementActiveSubscriptionsCount();
return onSubscribe;
});
RxJavaHooks.setOnObservableReturn(subscription -> {
rxIdlingResource.decrementActiveSubscriptionsCount();
return subscription;
});
RxJavaHooks.setOnObservableSubscribeError(throwable -> {
rxIdlingResource.decrementActiveSubscriptionsCount();
return throwable;
});
Espresso.registerIdlingResources(rxIdlingResource);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment