MraidController { public void destroy() { mScreenMetricsWaiter.cancelLastRequest(); try { mOrientationBroadcastReceiver.unregister(); } catch (IllegalArgumentException e) { if (!e.getMessage().contains("Receiver not registered")) { throw e; } } if (!mIsPaused) { pause(); } Views.removeFromParent(mCloseableAdContainer); mMraidBridge.detach(); if (mMraidWebView != null) { mMraidWebView.destroy(); mMraidWebView = null; } mTwoPartBridge.detach(); if (mTwoPartWebView != null) { mTwoPartWebView.destroy(); mTwoPartWebView = null; } } MraidController(@NonNull Context context, @NonNull AdConfiguration adConfiguration,
            @NonNull PlacementType placementType); @VisibleForTesting  MraidController(@NonNull Context context, @NonNull AdConfiguration adConfiguration,
            @NonNull PlacementType placementType,
            @NonNull MraidBridge bridge, @NonNull MraidBridge twoPartBridge,
            @NonNull ScreenMetricsWaiter screenMetricsWaiter); void setMraidListener(@Nullable MraidListener mraidListener); void setUseCustomCloseListener(@Nullable UseCustomCloseListener listener); void setDebugListener(@Nullable MraidWebViewDebugListener debugListener); void loadContent(@NonNull String htmlData); void pause(); void resume(); void destroy(); @NonNull FrameLayout getAdContainer(); void loadJavascript(@NonNull String javascript); @NonNull Context getContext();  }
@Test public void destroy_shouldCancelLastMetricsRequest_shouldUnregisterBroadcastReceiver_shouldDetachAllBridges() { subject.destroy(); verify(mockScreenMetricsWaiter).cancelLastRequest(); verify(mockOrientationBroadcastReceiver).unregister(); verify(mockBridge).detach(); verify(mockTwoPartBridge).detach(); }