public void testObservingAdapters() {
    MockAdapter adapterOld = new MockAdapter(1);
    mRecyclerView.setAdapter(adapterOld);
    assertTrue("attached adapter should have observables", adapterOld.hasObservers());

    MockAdapter adapterNew = new MockAdapter(2);
    mRecyclerView.setAdapter(adapterNew);
    assertFalse("detached adapter should lose observable", adapterOld.hasObservers());
    assertTrue("new adapter should have observers", adapterNew.hasObservers());

    mRecyclerView.setAdapter(null);
    assertNull("adapter should be removed successfully", mRecyclerView.getAdapter());
    assertFalse(
        "when adapter is removed, observables should be removed too", adapterNew.hasObservers());
  }
 @Override
 public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
   return mockAdaptable.adaptTo(this, type);
 }