Skip to content

Instantly share code, notes, and snippets.

@BartoszJarocki
Created May 14, 2017
Embed
What would you like to do?
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