### Question:
VPRendererAdapter extends PagerAdapter { @Override public Object instantiateItem(ViewGroup parent, int position) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withParent(parent); rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext())); Renderer<T> renderer = rendererBuilder.build(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null Renderer"); } updateRendererExtraValues(content, renderer, position); renderer.render(); View view = renderer.getRootView(); parent.addView(view); return view; } VPRendererAdapter(RendererBuilder<T> rendererBuilder);  VPRendererAdapter(RendererBuilder<T> rendererBuilder, AdapteeCollection<T> collection); @Override Object instantiateItem(ViewGroup parent, int position); @Override void destroyItem(ViewGroup container, int position, Object object); @Override boolean isViewFromObject(View view, Object o); @Override int getCount(); T getItem(int position); boolean add(T element); boolean remove(Object element); void addAll(Collection<? extends T> elements); boolean removeAll(Collection<?> elements); void clear(); void setCollection(AdapteeCollection<T> collection);  }### Answer:
@Test public void shouldBuildRendererUsingAllNeededDependencies() { when(mockedCollection.get(ANY_POSITION)).thenReturn(ANY_OBJECT); when(mockedRendererBuilder.build()).thenReturn(mockedRenderer); adapter.instantiateItem(mockedParent, ANY_POSITION); verify(mockedRendererBuilder).withParent(mockedParent); verify(mockedRendererBuilder).withContent(ANY_OBJECT); verify(mockedRendererBuilder).withLayoutInflater((LayoutInflater) notNull()); verify(mockedRendererBuilder).build(); }
@Test(expected = NullRendererBuiltException.class) public void shouldThrowNullRendererBuiltException() { adapter.instantiateItem(mockedParent, ANY_ITEM_VIEW_TYPE); }
@Test public void shouldGetRendererAndRenderIt() { when(mockedCollection.get(ANY_POSITION)).thenReturn(ANY_OBJECT); when(mockedRendererBuilder.build()).thenReturn(mockedRenderer); adapter.instantiateItem(mockedParent, ANY_POSITION); verify(mockedRenderer).render(); }