@Test public void checkSetNumberOfThumbs() { mContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mBar = Mockito.spy(new ThumbsBar(mContext, null)); } }); int screenWidthInPixelForTest = (int) (960 * mContext.getResources().getDisplayMetrics().density); int screenHeightInPixelForTest = (int) (960 * mContext.getResources().getDisplayMetrics().density); int numberOfThumbs = 3; mBar.setNumberOfThumbs(numberOfThumbs); mBar.measure(View.MeasureSpec.makeMeasureSpec( screenWidthInPixelForTest, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec( screenHeightInPixelForTest, View.MeasureSpec.EXACTLY)); assertEquals(mBar.getChildCount(), numberOfThumbs); }
public void setNumberOfThumbs(int numOfThumbs) { mIsUserSets = true; mNumOfThumbs = numOfThumbs; setNumberOfThumbsInternal(); }
ThumbsBar extends LinearLayout { public void setNumberOfThumbs(int numOfThumbs) { mIsUserSets = true; mNumOfThumbs = numOfThumbs; setNumberOfThumbsInternal(); } }
ThumbsBar extends LinearLayout { public void setNumberOfThumbs(int numOfThumbs) { mIsUserSets = true; mNumOfThumbs = numOfThumbs; setNumberOfThumbsInternal(); } ThumbsBar(Context context, AttributeSet attrs);  ThumbsBar(Context context, AttributeSet attrs, int defStyle); }
ThumbsBar extends LinearLayout { public void setNumberOfThumbs(int numOfThumbs) { mIsUserSets = true; mNumOfThumbs = numOfThumbs; setNumberOfThumbsInternal(); } ThumbsBar(Context context, AttributeSet attrs);  ThumbsBar(Context context, AttributeSet attrs, int defStyle); int getHeroIndex(); void setThumbSize(int width, int height); void setHeroThumbSize(int width, int height); void setThumbSpace(int spaceInPixel); void setNumberOfThumbs(int numOfThumbs); void clearThumbBitmaps(); Bitmap getThumbBitmap(int index); void setThumbBitmap(int index, Bitmap bitmap); }
ThumbsBar extends LinearLayout { public void setNumberOfThumbs(int numOfThumbs) { mIsUserSets = true; mNumOfThumbs = numOfThumbs; setNumberOfThumbsInternal(); } ThumbsBar(Context context, AttributeSet attrs);  ThumbsBar(Context context, AttributeSet attrs, int defStyle); int getHeroIndex(); void setThumbSize(int width, int height); void setHeroThumbSize(int width, int height); void setThumbSpace(int spaceInPixel); void setNumberOfThumbs(int numOfThumbs); void clearThumbBitmaps(); Bitmap getThumbBitmap(int index); void setThumbBitmap(int index, Bitmap bitmap);  }