@Override
  public final void dispose() {
    if (unsubscribed.compareAndSet(false, true)) {
      if (AutoDisposeAndroidUtil.isMainThread()) {
        onDispose();
      } else {
        AndroidSchedulers.mainThread().scheduleDirect(this::onDispose);
      }
    }
  }
@Test
  public void onDisposeFailsWhenMainThreadCheckNotSet() {
    try {
      new MainThreadDisposable() {
        @Override
        protected void onDispose() {}
      }.dispose();
      throw new AssertionError("Expected to fail before this due to Looper not being stubbed!");
    } catch (RuntimeException e) {
      // "Method myLooper in android.os.Looper not mocked..."
      // Not testing this exact message as it's an implementation detail of the test framework.
    }
  }