GalleryAdapter extends PagerAdapter { @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } GalleryAdapter(Context context, SwipeToDismissTouchListener.Callback callback); @Override int getCount(); @Override boolean isViewFromObject(View view, Object object); @Override Object instantiateItem(ViewGroup container, int position); @Override void destroyItem(ViewGroup container, int position, Object object);  }
@Test public void testDestroyItem() { subject.destroyItem(container, 0, view); verify(container).removeView(view); }