Skip to content

Commit 7f9e7e1

Browse files
committed
Initiak warnings are processes similarly to summaryMessage
1 parent 31ac80a commit 7f9e7e1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgTestClassConstructor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ data class TestsGenerationReport(
191191

192192
// Summary message is generated lazily to avoid evaluation of classUnderTest
193193
var summaryMessage: () -> String = { "Unit tests for $classUnderTest were generated successfully." }
194-
val initialWarnings: MutableList<String> = mutableListOf()
194+
val initialWarnings: MutableList<() -> String> = mutableListOf()
195195

196196
fun addMethodErrors(testCase: UtTestCase, errors: Map<String, Int>) {
197197
this.errors[testCase.method] = errors
@@ -219,7 +219,7 @@ data class TestsGenerationReport(
219219
override fun toString(): String = buildString {
220220
appendHtmlLine(summaryMessage())
221221
appendHtmlLine()
222-
initialWarnings.forEach { appendHtmlLine(it) }
222+
initialWarnings.forEach { appendHtmlLine(it()) }
223223
appendHtmlLine()
224224

225225
val testMethodsStatistic = executables.map { it.countTestMethods() }

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/TestGenerator.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,23 +350,23 @@ object TestGenerator {
350350
summaryMessage = { "Unit tests for $classUnderTest were generated with warnings.<br>" }
351351

352352
if (model.forceMockHappened) {
353-
initialWarnings.add(
353+
initialWarnings.add {
354354
"""
355355
<b>Warning</b>: Some test cases were ignored, because no mocking framework is installed in the project.<br>
356356
Better results could be achieved by <a href="${TestReportUrlOpeningListener.prefix}${TestReportUrlOpeningListener.mockitoSuffix}">installing mocking framework</a>.
357357
""".trimIndent()
358-
)
358+
}
359359
}
360360
if (model.hasTestFrameworkConflict) {
361-
initialWarnings.add(
361+
initialWarnings.add {
362362
"""
363363
<b>Warning</b>: There are several test frameworks in the project.
364364
To select run configuration, please refer to the documentation depending on the project build system:
365365
<a href=" https://docs.gradle.org/current/userguide/java_testing.html#sec:configuring_java_integration_tests">Gradle</a>,
366366
<a href=" https://maven.apache.org/surefire/maven-surefire-plugin/examples/providers.html">Maven</a>
367367
or <a href=" https://www.jetbrains.com/help/idea/run-debug-configuration.html#compound-configs">Idea</a>.
368368
""".trimIndent()
369-
)
369+
}
370370
}
371371
}
372372
}

0 commit comments

Comments
 (0)