### Question:
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();  }### Answer:
@Test public void testGetView_calls_update() { final TestView mockView = Mockito.mock(TestView.class); TypedArrayAdapter<String, TestView> adapter = new TypedArrayAdapter<String, TestView>(Robolectric.application, new String[] { "hello" }) { @Override public TestView createView() { return mockView; } }; adapter.getView(0, mockView, null); Mockito.verify(mockView).update(Mockito.anyString()); }
@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()); }