LayoutPresenters { @SuppressWarnings("unchecked") @NonNull public static Builder layoutPresenterFor(@LayoutRes int layoutId) { return new Builder(layoutId); } private  LayoutPresenters(); @SuppressWarnings("unchecked") @NonNull static Builder layoutPresenterFor(@LayoutRes int layoutId); @SuppressWarnings("unchecked") @NonNull static LayoutPresenter layout(@LayoutRes int layoutId);  }
@Test public void shouldReturnLayoutIdForCompiledLayout() { final LayoutPresenter layoutPresenter = layoutPresenterFor(LAYOUT_ID) .build(); assertThat(layoutPresenter.getLayoutResId(), is(LAYOUT_ID)); }
@Test public void shouldBindCompiledLayout() { final LayoutPresenter layoutPresenter = layoutPresenterFor(LAYOUT_ID) .bindWith(binder) .build(); layoutPresenter.bind(view); verify(binder).accept(view); }
@Test public void shouldBindCompiledLayoutWithoutBinder() { final LayoutPresenter layoutPresenter = layoutPresenterFor(LAYOUT_ID) .build(); layoutPresenter.bind(view); }
@Test public void shouldRecycleViewInCompiledLayout() { final LayoutPresenter layoutPresenter = layoutPresenterFor(LAYOUT_ID) .bindWith(binder) .recycleWith(recycler) .build(); layoutPresenter.recycle(view); verify(recycler).accept(view); }
@Test public void shouldHandleRecycleWithoutRecyclerInCompiledLayout() { final LayoutPresenter layoutPresenter = layoutPresenterFor(LAYOUT_ID) .bindWith(binder) .build(); layoutPresenter.recycle(view); }