ToolkitPresenter { public void run(String title) { checkInitialized(); initUncaughtExceptionsHandler(); view.setTitle(title); view.displayHighlightedSourceCode(""); view.displayAst(null); view.displayXml(""); view.disableXPathEvaluateButton(); initConfigurationTab(); view.run(); } ToolkitPresenter(ConfigurationModel configurationModel, SourceCodeModel model); void setView(ToolkitView view); void run(String title); void onSourceCodeOpenButtonClick(); void onSourceCodeParseButtonClick(); void onXPathEvaluateButtonClick(); void onSourceCodeKeyTyped(); void onSourceCodeTextCursorMoved(); void onAstSelectionChanged(); void onConfigurationPropertyFocusLost(String name);  }
@Test public void run() { ToolkitView view = mock(ToolkitView.class); ToolkitPresenter presenter = new ToolkitPresenter(mock(ConfigurationModel.class), mock(SourceCodeModel.class)); presenter.setView(view); presenter.run("my_mocked_title"); assertThat(Thread.currentThread().getUncaughtExceptionHandler() instanceof ThreadGroup).isFalse(); verify(view).setTitle("my_mocked_title"); verify(view).displayHighlightedSourceCode(""); verify(view).displayAst(null); verify(view).displayXml(""); verify(view).disableXPathEvaluateButton(); verify(view).run(); }
@Test public void runFailsWithoutView() { thrown.expect(IllegalStateException.class); new ToolkitPresenter(mock(ConfigurationModel.class), mock(SourceCodeModel.class)).run("foo"); }