File tree 2 files changed +5
-6
lines changed
utbot-framework/src/main/kotlin/org/utbot/framework
codegen/model/constructor/tree
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,16 @@ data class TestsGenerationReport(
19
19
var crashExecutions : MethodGeneratedTests = mutableMapOf(),
20
20
var errors : MutableMap <ExecutableId , ErrorsCount > = mutableMapOf()
21
21
) {
22
- val classUnderTest: KClass <* >
22
+ val classUnderTest: KClass <* >?
23
23
get() = executables.firstOrNull()?.classId?.kClass
24
- ? : error(" No executables found in test report" )
25
24
26
25
val initialWarnings: MutableList < () -> String > = mutableListOf ()
27
26
val hasWarnings: Boolean
28
27
get() = initialWarnings.isNotEmpty()
29
28
30
29
val detailedStatistics: String
31
30
get() = buildString {
32
- appendHtmlLine(" Class: ${classUnderTest .qualifiedName} " )
31
+ classUnderTest?. let { appendHtmlLine(" Class: ${it .qualifiedName} " ) }
33
32
val testMethodsStatistic = executables.map { it.countTestMethods() }
34
33
val errors = executables.map { it.countErrors() }
35
34
val overallErrors = errors.sum()
@@ -71,7 +70,7 @@ data class TestsGenerationReport(
71
70
}
72
71
73
72
fun toString (isShort : Boolean ): String = buildString {
74
- appendHtmlLine(" Target: ${classUnderTest .qualifiedName} " )
73
+ classUnderTest?. let { appendHtmlLine(" Target: ${it .qualifiedName} " ) }
75
74
if (initialWarnings.isNotEmpty()) {
76
75
initialWarnings.forEach { appendHtmlLine(it()) }
77
76
appendHtmlLine()
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ private fun EngineProcessModel.setup(
197
197
appendHtmlLine(report.toString(isShort = true ))
198
198
199
199
val classUnderTestPackageName =
200
- report.classUnderTest.java.nameOfPackage
200
+ report.classUnderTest? .java? .nameOfPackage ? : " "
201
201
202
202
destinationWarningMessage(testPackageName, classUnderTestPackageName)
203
203
?.let {
@@ -227,7 +227,7 @@ private fun EngineProcessModel.setup(
227
227
228
228
for (report in reports) {
229
229
val classUnderTestPackageName =
230
- report.classUnderTest.java.nameOfPackage
230
+ report.classUnderTest? .java? .nameOfPackage ? : " "
231
231
232
232
hasWarnings = hasWarnings || report.hasWarnings
233
233
if (! isMultiPackage) {
You can’t perform that action at this time.
0 commit comments