@Test public void testRemoveSource() { mSource.setValue("flatfoot"); Observer observer = mock(Observer.class); mMediator.addSource(mSource, observer); verify(observer).onChanged("flatfoot"); mMediator.removeSource(mSource); reset(observer); mSource.setValue("failure"); verify(observer, never()).onChanged(any()); }
@MainThread public <S> void removeSource(LiveData<S> toRemote) { Source<?> source = mSources.remove(toRemote); if (source != null) { source.unplug(); } }
MediatorLiveData extends MutableLiveData<T> { @MainThread public <S> void removeSource(LiveData<S> toRemote) { Source<?> source = mSources.remove(toRemote); if (source != null) { source.unplug(); } } }
MediatorLiveData extends MutableLiveData<T> { @MainThread public <S> void removeSource(LiveData<S> toRemote) { Source<?> source = mSources.remove(toRemote); if (source != null) { source.unplug(); } }  }
MediatorLiveData extends MutableLiveData<T> { @MainThread public <S> void removeSource(LiveData<S> toRemote) { Source<?> source = mSources.remove(toRemote); if (source != null) { source.unplug(); } }  @MainThread void addSource(LiveData<S> source, Observer<S> onChanged); @MainThread void removeSource(LiveData<S> toRemote); }
MediatorLiveData extends MutableLiveData<T> { @MainThread public <S> void removeSource(LiveData<S> toRemote) { Source<?> source = mSources.remove(toRemote); if (source != null) { source.unplug(); } }  @MainThread void addSource(LiveData<S> source, Observer<S> onChanged); @MainThread void removeSource(LiveData<S> toRemote);  }