1

I'm trying to test my custom arrayAdapter and I'm having issues getting any list to appear

public class PlanOfCareCheckBoxAdapterTest extends AndroidTestCase
{
PlanOfCareCheckBoxAdapter mAdapter;
List<String> values;
Context mContext;

public PlanOfCareCheckBoxAdapterTest() {
    super();
}

@Before
public void setUp() throws Exception {
    super.setUp();

    mContext = new MockContext();
    new POCValues(mContext);

    values = Arrays.asList("One", "two", "three");
    mAdapter = new PlanOfCareCheckBoxAdapter(mContext, R.layout.item_multi_check, values, POCValues.masterMap);
    assertEquals("Two", mAdapter.getItem(0));
}

My implementation:

public class PlanOfCareCheckBoxAdapter extends ArrayAdapter<String>{
private BiMap<Integer, String> map;
private Set<Integer> mPendingItems, mDoneItems;
private boolean isSuperUser;

public PlanOfCareCheckBoxAdapter(Context context, int resource, List objects, BiMap<Integer, String> mapping) {
    super(context, resource, objects);

    isSuperUser = false;
    mPendingItems = new HashSet<>();
    mDoneItems = new HashSet<>();
    map = mapping;
}

When I run this test I get an Actual result of null? why?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.