Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x: TestObserver's "isDisposed" #5178

Closed
ZacSweers opened this issue Mar 12, 2017 · 3 comments
Closed

2.x: TestObserver's "isDisposed" #5178

ZacSweers opened this issue Mar 12, 2017 · 3 comments

Comments

@ZacSweers
Copy link
Contributor

ZacSweers commented Mar 12, 2017

I have a DisposableObserver that has its own disposability implementation. It will correctly return the state when you hit isDisposed, but it is backed by a different enum (basically a fork of DisposableHelper, since it's internal-only). This is the delegate that TestObserver ends up wrapping in my test. Thing is, when you hit TestObserver#isDisposed(), it explicitly only does a reference comparison check between the disposable and the enum instance in DisposableHelper.

Is this intentional? If so, should isDisposed not be used with TestObserver in testing?

@ZacSweers
Copy link
Contributor Author

Another note on this - this also seems to break isSubscribed checks. The delegate observer is disposed now, but the wrapping TestObserver is still subscribed

@akarnokd
Copy link
Member

TestObserver is a special kind which has to allow dispose() to be called after it has received the terminal event. See #4872.

@ZacSweers
Copy link
Contributor Author

Gotcha, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants