@Test public void testGetView_calls_createView_and_update() { final TestView mockView = Mockito.mock(TestView.class); TypedArrayAdapterExtension adapter = new TypedArrayAdapterExtension(Robolectric.application, new String[] { "hello" }, mockView); adapter.getView(0, null, null); assertTrue(adapter.isCreateViewCalled); Mockito.verify(mockView).update(Mockito.anyString()); }
@SuppressWarnings("unchecked") @Override public C getView(int position, View convertView, ViewGroup parent) { C view = null; if (convertView != null) { view = (C) convertView; } else { view = createView(); } view.update(getItem(position)); return view; }
TypedArrayAdapter extends ArrayAdapter<T> { @SuppressWarnings("unchecked") @Override public C getView(int position, View convertView, ViewGroup parent) { C view = null; if (convertView != null) { view = (C) convertView; } else { view = createView(); } view.update(getItem(position)); return view; } }
TypedArrayAdapter extends ArrayAdapter<T> { @SuppressWarnings("unchecked") @Override public C getView(int position, View convertView, ViewGroup parent) { C view = null; if (convertView != null) { view = (C) convertView; } else { view = createView(); } view.update(getItem(position)); return view; } TypedArrayAdapter(Context context, List<T> objects);  TypedArrayAdapter(Context context, T[] objects);  TypedArrayAdapter(Context context); }
TypedArrayAdapter extends ArrayAdapter<T> { @SuppressWarnings("unchecked") @Override public C getView(int position, View convertView, ViewGroup parent) { C view = null; if (convertView != null) { view = (C) convertView; } else { view = createView(); } view.update(getItem(position)); return view; } TypedArrayAdapter(Context context, List<T> objects);  TypedArrayAdapter(Context context, T[] objects);  TypedArrayAdapter(Context context); @SuppressWarnings("unchecked") @Override C getView(int position, View convertView, ViewGroup parent); @Override int getViewTypeCount(); @Override int getItemViewType(int position); abstract C createView(); }
TypedArrayAdapter extends ArrayAdapter<T> { @SuppressWarnings("unchecked") @Override public C getView(int position, View convertView, ViewGroup parent) { C view = null; if (convertView != null) { view = (C) convertView; } else { view = createView(); } view.update(getItem(position)); return view; } TypedArrayAdapter(Context context, List<T> objects);  TypedArrayAdapter(Context context, T[] objects);  TypedArrayAdapter(Context context); @SuppressWarnings("unchecked") @Override C getView(int position, View convertView, ViewGroup parent); @Override int getViewTypeCount(); @Override int getItemViewType(int position); abstract C createView();  }