@@ -15,7 +15,6 @@ import com.intellij.openapi.editor.Editor
1515import com.intellij.openapi.project.DumbService
1616import com.intellij.openapi.project.Project
1717import com.intellij.openapi.util.Computable
18- import com.intellij.openapi.vfs.VfsUtil
1918import com.intellij.psi.JavaDirectoryService
2019import com.intellij.psi.PsiClass
2120import com.intellij.psi.PsiClassOwner
@@ -47,7 +46,6 @@ import org.jetbrains.kotlin.psi.psiUtil.endOffset
4746import org.jetbrains.kotlin.psi.psiUtil.startOffset
4847import org.jetbrains.kotlin.scripting.resolve.classId
4948import org.utbot.common.HTML_LINE_SEPARATOR
50- import org.utbot.common.PathUtil.classFqnToPath
5149import org.utbot.common.PathUtil.toHtmlLinkTag
5250import org.utbot.common.appendHtmlLine
5351import org.utbot.framework.codegen.Import
@@ -56,7 +54,6 @@ import org.utbot.framework.codegen.RegularImport
5654import org.utbot.framework.codegen.StaticImport
5755import org.utbot.framework.codegen.model.CodeGenerator
5856import org.utbot.framework.codegen.model.TestsCodeWithTestReport
59- import org.utbot.framework.codegen.model.constructor.tree.TestsGenerationReport
6057import org.utbot.framework.plugin.api.CodegenLanguage
6158import org.utbot.framework.plugin.api.UtMethod
6259import org.utbot.framework.plugin.api.UtMethodTestSet
@@ -70,16 +67,17 @@ import org.utbot.intellij.plugin.models.GenerateTestsModel
7067import org.utbot.intellij.plugin.models.packageName
7168import org.utbot.intellij.plugin.sarif.SarifReportIdea
7269import org.utbot.intellij.plugin.sarif.SourceFindingStrategyIdea
70+ import org.utbot.intellij.plugin.ui.DetailsTestsReportNotifier
7371import org.utbot.intellij.plugin.ui.SarifReportNotifier
7472import org.utbot.intellij.plugin.ui.TestReportUrlOpeningListener
7573import org.utbot.intellij.plugin.ui.TestsReportNotifier
74+ import org.utbot.intellij.plugin.ui.WarningTestsReportNotifier
7675import org.utbot.intellij.plugin.ui.utils.getOrCreateSarifReportsPath
7776import org.utbot.intellij.plugin.ui.utils.getOrCreateTestResourcesPath
7877import org.utbot.intellij.plugin.ui.utils.showErrorDialogLater
7978import org.utbot.intellij.plugin.util.signature
8079import org.utbot.sarif.SarifReport
8180import java.nio.file.Path
82- import java.nio.file.Paths
8381import java.util.concurrent.CountDownLatch
8482import java.util.concurrent.TimeUnit
8583import kotlin.reflect.KClass
@@ -167,7 +165,6 @@ object CodeGenerationController {
167165 SarifReportNotifier .notify(
168166 info = """
169167 SARIF report was saved to ${toHtmlLinkTag(mergedReportFile.path)}$HTML_LINE_SEPARATOR
170- You can open it using the VS Code extension "Sarif Viewer"
171168 """ .trimIndent()
172169 )
173170 }
@@ -394,32 +391,10 @@ object CodeGenerationController {
394391 " Test resources directory $testResourcesDirPath does not exist"
395392 }
396393
397- val testReportSubDir = " utbot-tests-report"
398- val classFqn = with (testsCodeWithTestReport.testsGenerationReport.classUnderTest) {
399- qualifiedName ? : error(" Could not save tests report for anonymous or local class $this " )
400- }
401- val fileReportPath = classFqnToPath(classFqn)
402-
403- val resultedReportedPath =
404- Paths .get(
405- testResourcesDirPath.toString(),
406- testReportSubDir,
407- fileReportPath + " TestReport" + TestsGenerationReport .EXTENSION
408- )
409-
410- val parent = resultedReportedPath.parent
411- requireNotNull(parent) {
412- " Expected from parent of $resultedReportedPath to be not null but it is null"
413- }
414-
415- VfsUtil .createDirectories(parent.toString())
416- resultedReportedPath.toFile().writeText(testsCodeWithTestReport.testsGenerationReport.getFileContent())
417-
418394 processInitialWarnings(testsCodeWithTestReport, model)
419395
420396 val notifyMessage = buildString {
421- appendHtmlLine(testsCodeWithTestReport.testsGenerationReport.toString())
422- appendHtmlLine()
397+ appendHtmlLine(testsCodeWithTestReport.testsGenerationReport.toString(isShort = true ))
423398 val classUnderTestPackageName =
424399 testsCodeWithTestReport.testsGenerationReport.classUnderTest.classId.packageFqName.toString()
425400 if (classUnderTestPackageName != model.testPackageName) {
@@ -430,12 +405,19 @@ object CodeGenerationController {
430405 appendHtmlLine(warningMessage)
431406 appendHtmlLine()
432407 }
433- val savedFileMessage = """
434- Tests report was saved to ${toHtmlLinkTag(resultedReportedPath.toString())} in TSV format
408+ val eventLogMessage = """
409+ <a href=" ${ TestReportUrlOpeningListener .prefix}${ TestReportUrlOpeningListener .eventLogSuffix} ">See details in Event Log</a>.
435410 """ .trimIndent()
436- appendHtmlLine(savedFileMessage)
411+ appendHtmlLine(eventLogMessage)
412+ }
413+
414+ if (testsCodeWithTestReport.testsGenerationReport.hasWarnings) {
415+ WarningTestsReportNotifier .notify(notifyMessage)
416+ } else {
417+ TestsReportNotifier .notify(notifyMessage)
437418 }
438- TestsReportNotifier .notify(notifyMessage)
419+
420+ DetailsTestsReportNotifier .notify(testsCodeWithTestReport.testsGenerationReport.detailedStatistics)
439421 }
440422
441423 private fun processInitialWarnings (testsCodeWithTestReport : TestsCodeWithTestReport , model : GenerateTestsModel ) {
@@ -445,8 +427,6 @@ object CodeGenerationController {
445427 }
446428
447429 testsCodeWithTestReport.testsGenerationReport.apply {
448- summaryMessage = { " Unit tests for $classUnderTest were generated with warnings.<br>" }
449-
450430 if (model.forceMockHappened) {
451431 initialWarnings.add {
452432 """
0 commit comments