ErrorReportPopoverView extends AbstractPopoverView implements ErrorReportPopover { @Override public void setup(final String errorTitleText, final String errorContentText, final String keepText, final String applyText, final Command applyCommand, final int mx, final int my, final Position position) { this.applyCommand = applyCommand; errorContent.setTextContent(errorContentText); keepButton.setInnerText(keepText); applyButton.setInnerText(applyText); applyButton.getStyle().setDisplay(Style.Display.INLINE); super.setup(Optional.of(errorTitleText), mx, my, position); } ErrorReportPopoverView(); @Inject  ErrorReportPopoverView(final Div errorContent,
                                  final Div popoverElement,
                                  final Div popoverContainerElement,
                                  final Div popoverContentElement,
                                  final JQueryProducer.JQuery<Popover> jQueryPopover); @Override void setup(final String errorTitleText,
                      final String errorContentText,
                      final String keepText,
                      final String applyText,
                      final Command applyCommand,
                      final int mx,
                      final int my,
                      final Position position); @Override void setup(final String errorTitleText,
                      final String errorContentText,
                      final String keepText,
                      final int mx,
                      final int my,
                      final Position position); @EventHandler("keepButton") void onKeepButtonClicked(ClickEvent clickEvent); @EventHandler("applyButton") void onApplyButtonClicked(ClickEvent clickEvent);  }
@Test public void setupWithCommand() { errorReportPopupView.setup(ERROR_TITLE_TEXT, ERROR_CONTENT_TEXT, KEEP_TEXT, APPLY_TEXT, applyCommandMock, MX, MY, PopoverView.Position.RIGHT); verify(errorReportPopupView, times(1)).addWidgetToRootPanel(); verify(popoverElementMock, times(1)).setAttribute(TITLE, ERROR_TITLE_TEXT); verify(jQueryPopoverMock, times(1)).wrap(elementMock); verify(popoverMock, times(1)).popover(isA(PopoverOptions.class)); verify(styleMock, times(1)).setProperty(eq(TOP),eq(TOP_PX)); verify(styleMock, times(1)).setProperty(eq(LEFT), eq(LEFT_PX)); verify(styleMock, times(1)).setProperty(eq(POSITION),eq(ABSOLUTE)); verify(errorContentMock, times(1)).setTextContent(eq(ERROR_CONTENT_TEXT)); verify(keepButtonMock, times(1)).setInnerText(eq(KEEP_TEXT)); verify(applyButtonMock, times(1)).setInnerText(eq(APPLY_TEXT)); verify(applyButtonMock.getStyle(), times(1)).setDisplay(eq(Style.Display.INLINE)); }
@Test public void setupWithoutCommand() { errorReportPopupView.setup(ERROR_TITLE_TEXT, ERROR_CONTENT_TEXT, KEEP_TEXT, MX, MY, PopoverView.Position.RIGHT); verify(errorReportPopupView, times(1)).addWidgetToRootPanel(); verify(popoverElementMock, times(1)).setAttribute(TITLE, ERROR_TITLE_TEXT); verify(jQueryPopoverMock, times(1)).wrap(elementMock); verify(popoverMock, times(1)).popover(isA(PopoverOptions.class)); verify(styleMock, times(1)).setProperty(eq(TOP),eq(TOP_PX)); verify(styleMock, times(1)).setProperty(eq(LEFT), eq(LEFT_PX)); verify(styleMock, times(1)).setProperty(eq(POSITION),eq(ABSOLUTE)); verify(errorContentMock, times(1)).setTextContent(eq(ERROR_CONTENT_TEXT)); verify(keepButtonMock, times(1)).setInnerText(eq(KEEP_TEXT)); verify(applyButtonMock.getStyle(), times(1)).setDisplay(eq(Style.Display.NONE)); }