RunnerManagerViewImpl extends BaseView<RunnerManagerView.ActionDelegate> implements RunnerManagerView { @NotNull private ButtonWidget createButton(@NotNull SVGResource icon, @NotNull String prompt, @NotNull ButtonWidget.ActionDelegate delegate, @NotNull FlowPanel buttonPanel) { ButtonWidget button = widgetFactory.createButton(prompt, icon); button.setDelegate(delegate); button.setDisable(); buttonPanel.add(button); return button; } @Inject  RunnerManagerViewImpl(PartStackUIResources partStackUIResources,
                                 RunnerResources resources,
                                 RunnerLocalizationConstant locale,
                                 WidgetFactory widgetFactory,
                                 AppContext appContext,
                                 PopupPanel moreInfoPopup,
                                 final PopupPanel menuPopup); @Override void update(@NotNull Runner runner); @Override void setApplicationURl(@Nullable String applicationUrl); @Override void setDebugPort(@Nullable String port); @Override void setTimeout(@NotNull String timeoutValue); @Override void showMoreInfoPopup(@Nullable Runner runner); @Override void updateMoreInfoPopup(@NotNull Runner runner); @Override void setLeftPanel(@NotNull TabContainer containerPresenter); @Override void setRightPropertiesPanel(@NotNull TabContainer containerPresenter); @Override void setLeftPropertiesPanel(@NotNull TabContainer containerPresenter); @Override void setGeneralPropertiesPanel(@NotNull TabContainer containerPresenter); @Override void hideOtherButtons(); @Override void showOtherButtons(); @Override void setEnableRunButton(boolean isEnable); @Override void setEnableReRunButton(boolean isEnable); @Override void setEnableStopButton(boolean isEnable); @Override void setEnableLogsButton(boolean isEnable); @Override void showLog(@NotNull String url); @UiHandler("appReference") void onAppReferenceClicked(@SuppressWarnings("UnusedParameters") ClickEvent clickEvent);  }
@Test public void prepareActionShouldBePerformed() { verify(widgetFactory).createMoreInfo(); verify(locale).runnersPanelTitle(); verify(moreInfoPopup).removeStyleName(GWT_POPUP_STANDARD_STYLE); verify(moreInfoPopup).add(moreInfoWidget); RunnerManagerView.ActionDelegate actionDelegate = mock(RunnerManagerView.ActionDelegate.class); view.setDelegate(actionDelegate); ArgumentCaptor<MouseOverHandler> mouseOverHandlerCaptor = ArgumentCaptor.forClass(MouseOverHandler.class); verify(view.moreInfoPanel).addDomHandler(mouseOverHandlerCaptor.capture(), eq(MouseOverEvent.getType())); MouseOverHandler mouseOverHandler = mouseOverHandlerCaptor.getValue(); mouseOverHandler.onMouseOver(mock(MouseOverEvent.class)); verify(view.image).addStyleName(TEXT); verify(actionDelegate).onMoreInfoBtnMouseOver(); ArgumentCaptor<MouseOutHandler> mouseOutHandlerCaptor = ArgumentCaptor.forClass(MouseOutHandler.class); verify(view.moreInfoPanel).addDomHandler(mouseOutHandlerCaptor.capture(), eq(MouseOutEvent.getType())); MouseOutHandler mouseOutHandler = mouseOutHandlerCaptor.getValue(); mouseOutHandler.onMouseOut(mock(MouseOutEvent.class)); verify(resources, times(4)).runnerCss(); verify(runnerCss, times(2)).opacityButton(); verify(view.image).removeStyleName(TEXT); verify(moreInfoPopup).hide(); verify(widgetFactory).createButton(TEXT, imageRun); verifyButton(imageRun, run, view.runButtonPanel); verify(actionDelegate).onRunButtonClicked(); verify(run).setEnable(); verify(widgetFactory).createButton(TEXT, imageReRun); verifyButton(imageReRun, reRun, view.otherButtonsPanel); verify(widgetFactory).createButton(TEXT, imageStop); verifyButton(imageStop, stop, view.otherButtonsPanel); verify(actionDelegate).onStopButtonClicked(); verify(widgetFactory).createButton(TEXT, imageLogs); verifyButton(imageLogs, logs, view.otherButtonsPanel); verify(actionDelegate).onLogsButtonClicked(); }
@Test public void menuShouldBeInitialized() throws Exception { verify(menuPopup).removeStyleName(GWT_POPUP_STANDARD_STYLE); verify(widgetFactory).createMenuWidget(); verify(widgetFactory).createMenuEntry(TEXT); verify(entry).setDelegate(Matchers.<MenuEntry.ActionDelegate>anyObject()); verify(menuWidget).addEntry(entry); verify(menuPopup).add(menuWidget); verify(widgetFactory).createButton(TEXT, menuIcon); headerMenuBtn.setEnable(); headerMenuBtn.setDelegate(Matchers.<ButtonWidget.ActionDelegate>anyObject()); verify(menuWidget).getSpan(); verify(span).addDomHandler(Matchers.<ClickHandler>anyObject(), eq(ClickEvent.getType())); }