RunnerUtilImpl implements RunnerUtil { @Override public void showError(@NotNull Runner runner, @NotNull String message, @Nullable Throwable exception) { Notification notification = new Notification(message, ERROR, true); showError(runner, message, exception, notification); notificationManager.showNotification(notification); } @Inject  RunnerUtilImpl(DialogFactory dialogFactory,
                          RunnerLocalizationConstant locale,
                          Provider<RunnerManagerPresenter> presenter,
                          ConsoleContainer consoleContainer,
                          NotificationManager notificationManager,
                          AppContext appContext); @Override boolean isRunnerMemoryCorrect(@Min(value=0) int totalMemory, @Min(value=0) int usedMemory, @Min(value=0) int availableMemory); @Override void showWarning(@NotNull String message); @Override void showError(@NotNull Runner runner, @NotNull String message, @Nullable Throwable exception); @Override void showError(@NotNull Runner runner,
                          @NotNull String message,
                          @Nullable Throwable exception,
                          @NotNull Notification notification); @Override boolean hasRunPermission();  }
@Test public void errorShouldBeShown() throws Exception { when(exception.getMessage()).thenReturn(null); util.showError(runner, SOME_TEXT, exception); verifyShowError(); verify(consoleContainer).printError(runner, SOME_TEXT); }
@Test public void errorShouldBeShownWhenExceptionIsNotNull() throws Exception { when(exception.getMessage()).thenReturn(SOME_TEXT); util.showError(runner, SOME_TEXT, exception); verifyShowError(); verify(consoleContainer).printError(runner, SOME_TEXT + ": " + SOME_TEXT); }