MraidController { @VisibleForTesting void lockOrientation(final int screenOrientation) throws MraidCommandException { final Activity activity = mWeakActivity.get(); if (activity == null || !shouldAllowForceOrientation(mForceOrientation)) { throw new MraidCommandException("Attempted to lock orientation to unsupported value: " + mForceOrientation.name()); } if (mOriginalActivityOrientation == null) { mOriginalActivityOrientation = activity.getRequestedOrientation(); } activity.setRequestedOrientation(screenOrientation); } MraidController(@NonNull Context context, @Nullable AdReport adReport,
            @NonNull PlacementType placementType); @VisibleForTesting  MraidController(@NonNull Context context, @Nullable AdReport adReport,
            @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(boolean isFinishing); 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(), mockAdReport, PlacementType.INLINE, mockBridge, mockTwoPartBridge, mockScreenMetricsWaiter); subject.lockOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }