CircularDrawable extends Drawable { @Override public void draw(Canvas canvas) { float offset = 0; if (useBorder) { offset = borderPaint.getStrokeWidth(); float diam = getIntrinsicWidth()/2; canvas.drawCircle(diam, diam, diam - offset/2, borderPaint); } canvas.drawCircle(getIntrinsicWidth()/2 , getIntrinsicHeight()/2 , diameter/2, paint); } CircularDrawable(Bitmap bitmap);  CircularDrawable(Bitmap bitmap, float explicitDiameter); float getDiameter(); void setBorder(float borderWidth, int borderColor); void clearBorder(); @Override void draw(Canvas canvas); @Override int getOpacity(); @Override void setAlpha(int alpha); @Override void setColorFilter(ColorFilter cf); @Override int getIntrinsicHeight(); @Override int getIntrinsicWidth();  }
@Test public void testDrawable() { Bitmap bitmap = Bitmap.createBitmap(200, 100, Bitmap.Config.ARGB_8888); CircularDrawable drawable = new CircularDrawable(bitmap); Canvas canvas = Mockito.mock(Canvas.class); drawable.draw(canvas); Mockito.verify(canvas, Mockito.times(1)).drawCircle(Mockito.anyFloat(), Mockito.anyFloat(), Mockito.anyFloat(), (Paint)Mockito.any()); }