Android RecyclerView Adapter is giving null on unit testing
问题 I am trying to test RecyclerView with AndroidJunit4, it is my test code: package com.kaushik.myredmart.ui; // all includes @RunWith(AndroidJUnit4.class) public class ProductListActivityTest { @Rule public ActivityTestRule<ProductListActivity> rule = new ActivityTestRule<>(ProductListActivity.class); @Test public void ensureListViewIsPresent() throws Exception { ProductListActivity activity = rule.getActivity(); View viewByIdw = activity.findViewById(R.id.productListView); assertThat(viewByIdw