mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
testng: unify notifications
This commit is contained in:
@@ -226,7 +226,7 @@ public class TestsUIUtil {
|
||||
myType = MessageType.INFO;
|
||||
}
|
||||
if (myComment != null) {
|
||||
myText += " (" + myComment + ")";
|
||||
myText += " " + myComment;
|
||||
}
|
||||
myBalloonText = myTitle + ": " + myText;
|
||||
}
|
||||
|
||||
+1
-18
@@ -161,25 +161,8 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
|
||||
final TestConsoleProperties consoleProperties = console.getProperties();
|
||||
if (consoleProperties == null) return;
|
||||
final String testRunDebugId = consoleProperties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN;
|
||||
final TestNGResults resultsView = console.getResultsView();
|
||||
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
|
||||
if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) {
|
||||
final MessageType type = resultsView == null || resultsView.getStatus() == MessageHelper.SKIPPED_TEST
|
||||
? MessageType.WARNING
|
||||
: (resultsView.getStatus() == MessageHelper.FAILED_TEST
|
||||
? MessageType.ERROR
|
||||
: MessageType.INFO);
|
||||
final String message;
|
||||
if (resultsView == null) {
|
||||
message = myStarted ? "Tests were interrupted" : "Tests were not started";
|
||||
}
|
||||
else {
|
||||
message = resultsView.getStatusLine();
|
||||
}
|
||||
toolWindowManager.notifyByBalloon(testRunDebugId, type, message, null, null);
|
||||
TestsUIUtil.NOTIFICATION_GROUP.createNotification(message, type).notify(project);
|
||||
}
|
||||
TestsUIUtil.notifyByBalloon(project, myStarted, console.getResultsView().getRoot(), consoleProperties, "in " + resultsView.getTime());
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater(notificationRunnable);
|
||||
|
||||
@@ -209,6 +209,11 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
final long time = end - start;
|
||||
return time == 0 ? "0.0 s" : NumberFormat.getInstance().format((double)time / 1000.0) + " s";
|
||||
}
|
||||
|
||||
public TestProxy testStarted(TestResultMessage result) {
|
||||
return testStarted(result, true);
|
||||
|
||||
Reference in New Issue
Block a user