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 Should observer be disposed after the source observable has finished emitting items? #4514

Closed
VictorAlbertos opened this issue Sep 8, 2016 · 4 comments
Labels
Milestone

Comments

@VictorAlbertos
Copy link
Contributor

With 1.x this test pass:

@Test
  public void subscriberShouldBeUnsubscribed() {
    rx.observers.TestSubscriber subscriber = new rx.observers.TestSubscriber();
    rx.Observable.just("").subscribe(subscriber);
    subscriber.awaitTerminalEvent();

    subscriber.assertNoErrors();
    subscriber.assertCompleted();
    subscriber.assertUnsubscribed();
  }

But with 2.x this test does not pass:

  @Test
  public void observerShouldBeDisposed()  {
    TestObserver observer = new TestObserver();
    Observable.just("").subscribe(observer);
    observer.awaitTerminalEvent();

    observer.assertNoErrors();
    observer.assertComplete();
    assertThat(observer.isDisposed(), is(true));
  }

I think that dispose is similar to unsubscribe (but maybe I'm wrong). So I was wondering if this is the expected behaviour.

Thanks.

@akarnokd akarnokd added the Bug label Sep 8, 2016
@akarnokd
Copy link
Member

akarnokd commented Sep 8, 2016

It's a small inconsistency. I'll fix that in my next cleanup/coverage PR.

@akarnokd akarnokd added this to the 2.0 RC 3 milestone Sep 8, 2016
@akarnokd
Copy link
Member

akarnokd commented Sep 8, 2016

Closing via 1145819

@maksim-m
Copy link
Contributor

@akarnokd, with RxJava 2.0.7 the test still fails:

    @Test
    public void observerShouldBeDisposed()  {
        TestObserver observer = new TestObserver();
        Observable.just("").subscribe(observer);
        observer.awaitTerminalEvent();

        observer.assertNoErrors();
        observer.assertComplete();
        assertTrue(observer.isDisposed());
    }

@akarnokd
Copy link
Member

There was a problem with that change and has been reverted in #4873.

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

No branches or pull requests

3 participants