// Path: extensions/rvdatabinding/src/test/java/android/databinding/DataBinderMapper.java
// public static void setDataBinding(ViewDataBinding dataBinding, int layoutId) {
//   bindings.put(layoutId, dataBinding);
// }
// 
// Path: extensions/rvdatabinding/src/test/java/com/google/android/agera/rvdatabinding/test/matchers/HasPrivateConstructor.java
// @NonNull
// @Factory
// public static Matcher<Class<?>> hasPrivateConstructor() {
//   return INSTANCE;
// }
// 
// Path: extensions/rvdatabinding/src/main/java/com/google/android/agera/rvdatabinding/DataBindingLayoutPresenters.java
// @SuppressWarnings("unchecked")
// @NonNull
// public static Builder dataBindingLayoutPresenterFor(@LayoutRes final int layoutId) {
//   return new Builder(layoutId);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Binder.java
// public interface Binder<TFirst, TSecond> {
// 
//   /**
//    * Accepts the given values {@code first} and {@code second}.
//    */
//   void bind(@NonNull TFirst first, @NonNull TSecond second);
// }
// 
// Path: extensions/rvadapter/src/main/java/com/google/android/agera/rvadapter/LayoutPresenter.java
// public abstract class LayoutPresenter {
//   /**
//    * Returns the layout resource ID to inflate.
//    */
//   @LayoutRes
//   public abstract int getLayoutResId();
// 
//   /**
//    * Updates the view to present. The view is inflated from the layout resource specified by
//    * {@link #getLayoutResId}, but may have been previously updated with a different presenter.
//    * Therefore, implementation should take care of resetting the view state.
//    *
//    * @param view The view to present.
//    */
//   public abstract void bind(@NonNull final View view);
// 
//   /**
//    * Called when the given {@code view} is recycled.
//    *
//    * @param view The view to recycle.
//    */
//   public void recycle(@NonNull final View view) {}
// }


import static android.databinding.DataBinderMapper.setDataBinding;
import static com.google.android.agera.rvdatabinding.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static com.google.android.agera.rvdatabinding.DataBindingLayoutPresenters.dataBindingLayoutPresenterFor;
import static com.google.android.agera.rvdatabinding.RecycleConfig.CLEAR_ALL;
import static com.google.android.agera.rvdatabinding.RecycleConfig.CLEAR_HANDLERS;
import static com.google.android.agera.rvdatabinding.RecycleConfig.CLEAR_ITEM;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import android.databinding.ViewDataBinding;
import android.support.annotation.LayoutRes;
import android.view.View;
import com.google.android.agera.Binder;
import com.google.android.agera.rvadapter.LayoutPresenter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
            .onRecycle(CLEAR_ALL)
            .build();

    layoutPresenter.recycle(view);

    verify(viewDataBinding).setVariable(HANDLER_ID, null);
    verify(viewDataBinding).setVariable(SECOND_HANDLER_ID, null);
    verify(viewDataBinding).executePendingBindings();
    verifyNoMoreInteractions(viewDataBinding);
  }

  @Test
  public void shouldRecycleLayoutPresenterWithHandlerRecycling() {
    final LayoutPresenter layoutPresenter =
        dataBindingLayoutPresenterFor(LAYOUT_ID)
            .handler(HANDLER_ID, HANDLER)
            .handler(SECOND_HANDLER_ID, SECOND_HANDLER)
            .onRecycle(CLEAR_HANDLERS)
            .build();

    layoutPresenter.recycle(view);

    verify(viewDataBinding).setVariable(HANDLER_ID, null);
    verify(viewDataBinding).setVariable(SECOND_HANDLER_ID, null);
    verify(viewDataBinding).executePendingBindings();
    verifyNoMoreInteractions(viewDataBinding);
  }

  @Test
  public void shouldBindLayoutPresenter() {
// Path: extensions/rvdatabinding/src/test/java/android/databinding/DataBinderMapper.java
// public static void setDataBinding(ViewDataBinding dataBinding, int layoutId) {
//   bindings.put(layoutId, dataBinding);
// }
// 
// Path: extensions/rvdatabinding/src/test/java/com/google/android/agera/rvdatabinding/test/matchers/HasPrivateConstructor.java
// @NonNull
// @Factory
// public static Matcher<Class<?>> hasPrivateConstructor() {
//   return INSTANCE;
// }
// 
// Path: extensions/rvdatabinding/src/main/java/com/google/android/agera/rvdatabinding/DataBindingLayoutPresenters.java
// @SuppressWarnings("unchecked")
// @NonNull
// public static Builder dataBindingLayoutPresenterFor(@LayoutRes final int layoutId) {
//   return new Builder(layoutId);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Binder.java
// public interface Binder<TFirst, TSecond> {
// 
//   /**
//    * Accepts the given values {@code first} and {@code second}.
//    */
//   void bind(@NonNull TFirst first, @NonNull TSecond second);
// }
// 
// Path: extensions/rvadapter/src/main/java/com/google/android/agera/rvadapter/LayoutPresenter.java
// public abstract class LayoutPresenter {
//   /**
//    * Returns the layout resource ID to inflate.
//    */
//   @LayoutRes
//   public abstract int getLayoutResId();
// 
//   /**
//    * Updates the view to present. The view is inflated from the layout resource specified by
//    * {@link #getLayoutResId}, but may have been previously updated with a different presenter.
//    * Therefore, implementation should take care of resetting the view state.
//    *
//    * @param view The view to present.
//    */
//   public abstract void bind(@NonNull final View view);
// 
//   /**
//    * Called when the given {@code view} is recycled.
//    *
//    * @param view The view to recycle.
//    */
//   public void recycle(@NonNull final View view) {}
// }


// Path: extensions/rvdatabinding/src/test/java/com/google/android/agera/rvdatabinding/DataBindingLayoutPresentersTest.java
import static android.databinding.DataBinderMapper.setDataBinding;
import static com.google.android.agera.rvdatabinding.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static com.google.android.agera.rvdatabinding.DataBindingLayoutPresenters.dataBindingLayoutPresenterFor;
import static com.google.android.agera.rvdatabinding.RecycleConfig.CLEAR_ALL;
import static com.google.android.agera.rvdatabinding.RecycleConfig.CLEAR_HANDLERS;
import static com.google.android.agera.rvdatabinding.RecycleConfig.CLEAR_ITEM;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import android.databinding.ViewDataBinding;
import android.support.annotation.LayoutRes;
import android.view.View;
import com.google.android.agera.Binder;
import com.google.android.agera.rvadapter.LayoutPresenter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

            .onRecycle(CLEAR_ALL)
            .build();

    layoutPresenter.recycle(view);

    verify(viewDataBinding).setVariable(HANDLER_ID, null);
    verify(viewDataBinding).setVariable(SECOND_HANDLER_ID, null);
    verify(viewDataBinding).executePendingBindings();
    verifyNoMoreInteractions(viewDataBinding);
  }

  @Test
  public void shouldRecycleLayoutPresenterWithHandlerRecycling() {
    final LayoutPresenter layoutPresenter =
        dataBindingLayoutPresenterFor(LAYOUT_ID)
            .handler(HANDLER_ID, HANDLER)
            .handler(SECOND_HANDLER_ID, SECOND_HANDLER)
            .onRecycle(CLEAR_HANDLERS)
            .build();

    layoutPresenter.recycle(view);

    verify(viewDataBinding).setVariable(HANDLER_ID, null);
    verify(viewDataBinding).setVariable(SECOND_HANDLER_ID, null);
    verify(viewDataBinding).executePendingBindings();
    verifyNoMoreInteractions(viewDataBinding);
  }

  @Test
  public void shouldBindLayoutPresenter() {
    final LayoutPresenter layoutPresenter =