@Test
 public void shouldCopyBitmap() {
   Bitmap bitmap = Shadow.newInstanceOf(Bitmap.class);
   Bitmap bitmapCopy = bitmap.copy(Config.ARGB_8888, true);
   assertThat(shadowOf(bitmapCopy).getConfig()).isEqualTo(Config.ARGB_8888);
   assertThat(shadowOf(bitmapCopy).isMutable()).isTrue();
 }
  @Test
  public void startAndStopManagingCursorTracksCursors() throws Exception {
    TestActivity activity = new TestActivity();

    ShadowActivity shadow = shadowOf(activity);

    assertThat(shadow.getManagedCursors()).isNotNull();
    assertThat(shadow.getManagedCursors().size()).isEqualTo(0);

    Cursor c = Shadow.newInstanceOf(SQLiteCursor.class);
    activity.startManagingCursor(c);

    assertThat(shadow.getManagedCursors()).isNotNull();
    assertThat(shadow.getManagedCursors().size()).isEqualTo(1);
    assertThat(shadow.getManagedCursors().get(0)).isSameAs(c);

    activity.stopManagingCursor(c);

    assertThat(shadow.getManagedCursors()).isNotNull();
    assertThat(shadow.getManagedCursors().size()).isEqualTo(0);
  }
 private static Bitmap create(String name) {
   Bitmap bitmap = Shadow.newInstanceOf(Bitmap.class);
   shadowOf(bitmap).appendDescription(name);
   return bitmap;
 }
 @Implementation
 public void setOnRefreshListener(OnRefreshListener listener) {
   this.listener = listener;
   Shadow.directlyOn(realObject, SwipeRefreshLayout.class).setOnRefreshListener(listener);
 }
 @Implementation
 public void invalidateSelf() {
   wasInvalidated = true;
   Shadow.directlyOn(realDrawable, Drawable.class, "invalidateSelf");
 }
 @Implementation
 public void setAlpha(int alpha) {
   this.alpha = alpha;
   Shadow.directlyOn(realDrawable, Drawable.class).setAlpha(alpha);
 }