@Before public void setUp() { activity = Robolectric.buildActivity(Activity.class).create().get(); subjectBanner = new MraidBridge(mockAdReport, PlacementType.INLINE, mockNativeCommandHandler); subjectBanner.setMraidBridgeListener(mockBridgeListener); subjectBanner.attachView(mockBannerWebView); subjectInterstitial = new MraidBridge(mockAdReport, PlacementType.INTERSTITIAL, mockNativeCommandHandler); subjectInterstitial.setMraidBridgeListener(mockBridgeListener); subjectInterstitial.attachView(mockInterstitialWebView); verify(mockBannerWebView).setWebViewClient(bannerWebViewClientCaptor.capture()); reset(mockBannerWebView); }
@Test(expected = MraidCommandException.class) public void runCommand_requiresClick_notClicked_shouldThrowException() throws MraidCommandException { subjectBanner = new MraidBridge(mockAdReport, PlacementType.INLINE); subjectBanner.attachView(mockBannerWebView); subjectBanner.setClicked(false); Map<String, String> params = new HashMap<String, String>(); params.put("uri", "http://valid-url"); subjectBanner.runCommand(MraidJavascriptCommand.PLAY_VIDEO, params); }