ConsoleImpl extends Composite implements Console { @Override public void changeWrapTextParam() { isWrappedText = !isWrappedText; String wrappedText = res.runnerCss().wrappedText(); for (int i = 0; i < output.getWidgetCount(); i++) { Widget widget = output.getWidget(i); if (isWrappedText) { widget.addStyleName(wrappedText); } else { widget.removeStyleName(wrappedText); } } } @Inject  ConsoleImpl(RunnerResources resources,
                       Provider<MessageBuilder> messageBuilderProvider,
                       WidgetFactory widgetFactory,
                       @NotNull @Assisted Runner runner); @Override void print(@NotNull String text); @Override void printInfo(@NotNull String line); @Override void printError(@NotNull String line); @Override void printWarn(@NotNull String line); @Override void scrollBottom(); @Override void clear(); @Override void changeWrapTextParam(); @Override boolean isWrapText();  }
@Test public void shouldChangeWrapTextParamWhenIsWrappedTextIsTrue() { when(console.output.getWidgetCount()).thenReturn(2); when(console.output.getWidget(0)).thenReturn(widget1); when(console.output.getWidget(1)).thenReturn(widget2); console.changeWrapTextParam(); verify(res).runnerCss(); verify(css).wrappedText(); verify(console.output, times(3)).getWidgetCount(); verify(console.output).getWidget(0); verify(console.output).getWidget(1); verify(widget1).addStyleName(SOME_TEXT); verify(widget2).addStyleName(SOME_TEXT); }
@Test public void shouldChangeWrapTextParamWhenIsWrappedTextIsFalse() { when(console.output.getWidgetCount()).thenReturn(2); when(console.output.getWidget(0)).thenReturn(widget1); when(console.output.getWidget(1)).thenReturn(widget2); console.changeWrapTextParam(); reset(widget1, widget2); console.changeWrapTextParam(); verify(res, times(2)).runnerCss(); verify(css, times(2)).wrappedText(); verify(console.output, times(6)).getWidgetCount(); verify(console.output, times(2)).getWidget(0); verify(console.output, times(2)).getWidget(1); verify(widget1).removeStyleName(SOME_TEXT); verify(widget2).removeStyleName(SOME_TEXT); }