From a4022aa99f7f9d736b125e16b59f8963e2e21490 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Mon, 5 Dec 2022 15:00:04 +0300 Subject: [PATCH] Don't show error message when user explicitly cancel test generation #1307 --- .../plugin/generator/UtTestsDialogProcessor.kt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt index 79807c2afc..ec490706e0 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt @@ -247,14 +247,18 @@ object UtTestsDialogProcessor { ) if (rdGenerateResult.notEmptyCases == 0) { - if (model.srcClasses.size > 1) { - logger.error { "Failed to generate any tests cases for class $className" } + if (!indicator.isCanceled) { + if (model.srcClasses.size > 1) { + logger.error { "Failed to generate any tests cases for class $className" } + } else { + showErrorDialogLater( + model.project, + errorMessage(className, secondsTimeout), + title = "Failed to generate unit tests for class $className" + ) + } } else { - showErrorDialogLater( - model.project, - errorMessage(className, secondsTimeout), - title = "Failed to generate unit tests for class $className" - ) + logger.warn { "Generation was cancelled for class $className" } } } else { testSetsByClass[srcClass] = rdGenerateResult