use of com.beloo.chipslayoutmanager.sample.ui.LayoutManagerFactory in project ChipsLayoutManager by BelooS.
the class ColumnTest method setUp.
@Before
public void setUp() throws Throwable {
MockitoAnnotations.initMocks(this);
activity = activityTestRule.getActivity();
recyclerView = onView(withId(R.id.rvTest)).check(matches(isDisplayed()));
layoutManager = getLayoutManager();
LayoutManagerFactory layoutManagerFactory = new LayoutManagerFactory() {
@Override
public RecyclerView.LayoutManager layoutManager(Context context) {
//we need clean layout manager for each request
return retrieveLayoutManager();
}
};
//set items
ChipsFacade chipsFacade = spy(new ChipsFacade());
items = chipsFacade.getItems();
when(chipsFacade.getItems()).thenReturn(items);
TestActivity.setItemsFactory(chipsFacade);
TestActivity.setLmFactory(layoutManagerFactory);
activity.runOnUiThread(() -> activity.initialize());
}
use of com.beloo.chipslayoutmanager.sample.ui.LayoutManagerFactory in project ChipsLayoutManager by BelooS.
the class RowTest method setUp.
@Before
public final void setUp() throws Throwable {
MockitoAnnotations.initMocks(this);
activity = activityTestRule.getActivity();
LayoutManagerFactory layoutManagerFactory = new LayoutManagerFactory() {
@Override
public RecyclerView.LayoutManager layoutManager(Context context) {
return retrieveLayoutManager();
}
};
RecyclerView rvTest = (RecyclerView) activityTestRule.getActivity().findViewById(R.id.rvTest);
//disable all animations
rvTest.setItemAnimator(null);
//set items
ChipsFacade chipsFacade = spy(new ChipsFacade());
items = chipsFacade.getItems();
when(chipsFacade.getItems()).thenReturn(items);
TestActivity.setItemsFactory(chipsFacade);
TestActivity.setLmFactory(layoutManagerFactory);
recyclerView = onView(withId(R.id.rvTest)).check(matches(isDisplayed()));
onSetUp();
activity.runOnUiThread(() -> activity.initialize());
}
Aggregations