@Test
public void testWeak() throws InterruptedException {

    final AtomicInteger data = new AtomicInteger(0);
    InvalidationTracker.Observer observer = new InvalidationTracker.Observer("a") {
        @Override
        public void onInvalidated(@NonNull Set<String> tables) {
            data.incrementAndGet();
        }
    };
    mTracker.addWeakObserver(observer);
    setVersions(1, 0);
    refreshSync();
    assertThat(data.get(), is(1));
    observer = null;
    forceGc();
    setVersions(2, 0);
    refreshSync();
    assertThat(data.get(), is(1));
}