NoxView extends View { public void setShape(Shape shape) { validateShape(shape); this.shape = shape; this.shape.calculate(); initializeScroller(); resetScroll(); } 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 public void shouldInvalidateViewOnNewShapeConfigured() { noxView = spy(noxView); Shape shape = givenAShapeConfiguredToReturn(ANY_MIN_X, ANY_MAX_X, ANY_MIN_Y, ANY_MAX_Y, ANY_OVER_SIZE); noxView.setShape(shape); verify(noxView).invalidate(); }
@Test(expected = NullPointerException.class) public void shouldNotAcceptNullShapeInstances() { noxView.setShape(null); }