MraidController { @VisibleForTesting void lockOrientation(final int screenOrientation) throws MraidCommandException { if (mActivity == null || !shouldAllowForceOrientation(mForceOrientation)) { throw new MraidCommandException("Attempted to lock orientation to unsupported value: " + mForceOrientation.name()); } if (mOriginalActivityOrientation == null) { mOriginalActivityOrientation = mActivity.getRequestedOrientation(); } mActivity.setRequestedOrientation(screenOrientation); } 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(expected = MraidCommandException.class) public void lockOrientation_withApplicationContext_shouldThrowMraidCommandException() throws MraidCommandException, PackageManager.NameNotFoundException { setMockActivityInfo(true, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, ActivityInfo.CONFIG_ORIENTATION | ActivityInfo.CONFIG_SCREEN_SIZE); subject = new MraidController( activity.getApplicationContext(), mockAdConfiguration, PlacementType.INLINE, mockBridge, mockTwoPartBridge, mockScreenMetricsWaiter); subject.lockOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }