### Question:
RendererAdapter extends BaseAdapter { @Override public View getView(int position, View convertView, ViewGroup parent) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withConvertView(convertView); 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(); return renderer.getRootView(); } RendererAdapter(RendererBuilder<T> rendererBuilder);  RendererAdapter(RendererBuilder<T> rendererBuilder, AdapteeCollection<T> collection); @Override int getCount(); @Override T getItem(int position); @Override long getItemId(int position); void setCollection(AdapteeCollection<T> collection); @Override View getView(int position, View convertView, ViewGroup parent); @Override int getItemViewType(int position); @Override int getViewTypeCount(); void add(T element); void remove(Object element); void addAll(Collection<? extends T> elements); void removeAll(Collection<?> elements); void clear();  }### Answer:
@Test public void shouldBuildRendererUsingAllNeededDependencies() { when(mockedCollection.get(ANY_POSITION)).thenReturn(ANY_OBJECT); when(mockedRendererBuilder.build()).thenReturn(mockedRenderer); rendererAdapter.getView(ANY_POSITION, mockedConvertView, mockedParent); verify(mockedRendererBuilder).withContent(ANY_OBJECT); verify(mockedRendererBuilder).withConvertView(mockedConvertView); verify(mockedRendererBuilder).withParent(mockedParent); verify(mockedRendererBuilder).withLayoutInflater((LayoutInflater) notNull()); }
@Test(expected = NullRendererBuiltException.class) public void shouldThrowNullRendererBuiltException() { rendererAdapter.getView(ANY_POSITION, mockedConvertView, mockedParent); }
@Test public void shouldRenderTheRendererBuilt() { when(mockedRendererBuilder.build()).thenReturn(mockedRenderer); rendererAdapter.getView(ANY_POSITION, mockedConvertView, mockedParent); verify(mockedRenderer).render(); }
@Test public void shouldReturnRendererRootView() { when(mockedRendererBuilder.build()).thenReturn(mockedRenderer); when(mockedRenderer.getRootView()).thenReturn(mockedView); View renderedView = rendererAdapter.getView(ANY_POSITION, mockedConvertView, mockedParent); assertEquals(mockedView, renderedView); }