NoxView extends View { public void showNoxItems(final List<NoxItem> noxItems) { this.post(new Runnable() { @Override public void run() { initializeNoxItemCatalog(noxItems); createShape(); initializeScroller(); refreshView(); } }); } NoxView(Context context);  NoxView(Context context, AttributeSet attrs);  NoxView(Context context, AttributeSet attrs, int defStyleAttr); @TargetApi(Build.VERSION_CODES.LOLLIPOP)  NoxView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes); void showNoxItems(final List<NoxItem> noxItems); void notifyDataSetChanged(); void setShape(Shape shape); @Override boolean onTouchEvent(MotionEvent event); @Override void computeScroll(); int getMinX(); int getMaxX(); int getMinY(); int getMaxY(); int getOverSize(); Shape getShape(); void setOnNoxItemClickListener(OnNoxItemClickListener listener); void resetScroll();  }
@Test(expected = NullPointerException.class) public void shouldNotAcceptANullNoxItemListToShow() { noxView.showNoxItems(null); }
@Test public void shouldAcceptAnEmptyListOfNoxItems() { noxView.showNoxItems(Collections.EMPTY_LIST); }
@Test public void shouldAcceptANonEmptyListOfNoxItems() { List<NoxItem> noxItems = givenOneListWithJustOneNoxItem(); noxView.showNoxItems(noxItems); }
@Test public void shouldInvalidateViewOnNewNoxItemsConfigured() { noxView = spy(noxView); noxView.showNoxItems(Collections.EMPTY_LIST); verify(noxView).invalidate(); }
@Test public void shouldNotDrawAnyNoxItemIfNoxItemCatalogHasNotDownloadAnyResource() { Canvas canvas = mock(Canvas.class); List<NoxItem> noxItems = givenOneListWithJustOneNoxItem(); noxView.showNoxItems(noxItems); noxView.draw(canvas); verify(canvas, never()).drawBitmap(any(Bitmap.class), anyInt(), anyInt(), any(Paint.class)); }