@Test
public void basicAddRemove() {

    Flowable<Object> flowable = RxRoom.createFlowable(mDatabase, "a", "b");
    verify(mInvalidationTracker, never()).addObserver(any(InvalidationTracker.Observer.class));
    Disposable disposable = flowable.subscribe();
    verify(mInvalidationTracker).addObserver(any(InvalidationTracker.Observer.class));
    assertThat(mAddedObservers.size(), CoreMatchers.is(1));
    InvalidationTracker.Observer observer = mAddedObservers.get(0);
    disposable.dispose();
    verify(mInvalidationTracker).removeObserver(observer);
    disposable = flowable.subscribe();
    verify(mInvalidationTracker, times(2))
            .addObserver(any(InvalidationTracker.Observer.class));
    assertThat(mAddedObservers.size(), CoreMatchers.is(2));
    assertThat(mAddedObservers.get(1), CoreMatchers.not(CoreMatchers.sameInstance(observer)));
    InvalidationTracker.Observer observer2 = mAddedObservers.get(1);
    disposable.dispose();
    verify(mInvalidationTracker).removeObserver(observer2);
}