@Test public void destroy_shouldRemoveSelfFromParent_beforeCallingDestroy() throws Exception { subject = new BaseWebView(context); ViewGroup parent = mock(ViewGroup.class); ShadowWebView shadow = shadowOf(subject); shadow.setMyParent(parent); subject.destroy(); verify(parent).removeView(eq(subject)); assertThat(shadow.wasDestroyCalled()).isTrue(); }
@Override public void destroy() { mIsDestroyed = true; Views.removeFromParent(this); removeAllViews(); super.destroy(); }
BaseWebView extends WebView { @Override public void destroy() { mIsDestroyed = true; Views.removeFromParent(this); removeAllViews(); super.destroy(); } }
BaseWebView extends WebView { @Override public void destroy() { mIsDestroyed = true; Views.removeFromParent(this); removeAllViews(); super.destroy(); } BaseWebView(Context context); }
BaseWebView extends WebView { @Override public void destroy() { mIsDestroyed = true; Views.removeFromParent(this); removeAllViews(); super.destroy(); } BaseWebView(Context context); @Override void destroy(); }
BaseWebView extends WebView { @Override public void destroy() { mIsDestroyed = true; Views.removeFromParent(this); removeAllViews(); super.destroy(); } BaseWebView(Context context); @Override void destroy();  }