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

Completable.doOnDipose() not called when disposing with TestObserver #4872

Closed
vanniktech opened this issue Nov 22, 2016 · 2 comments
Closed

Comments

@vanniktech
Copy link
Collaborator

The following test case fails:

final AtomicBoolean atomicBoolean = new AtomicBoolean();

assertThat(atomicBoolean.get()).isFalse();

Completable.complete()
    .doOnDispose(() -> atomicBoolean.set(true))
    .test()
    .assertResult()
    .dispose();

assertThat(atomicBoolean.get()).isTrue(); // Fails

In my opinion this is a bit misleading and probably should not be the case. Is this working as intended?

@akarnokd akarnokd added the 2.x label Nov 22, 2016
@akarnokd
Copy link
Member

Apparently TestObserver disconnects from the upstream on onComplete but TestSubscriber doesn't so this might be some residue. I'll post a PR to fix this.

Generally though, some operators disconnect in a similar fashion so calling dispose has no effect after they complete.

@akarnokd
Copy link
Member

Closing via #4873

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