@@ -94,6 +94,7 @@ import org.utbot.framework.plugin.api.ClassId
94
94
import org.utbot.framework.plugin.api.CodegenLanguage
95
95
import org.utbot.framework.plugin.api.ConcreteExecutionFailureException
96
96
import org.utbot.framework.plugin.api.ConstructorId
97
+ import org.utbot.framework.plugin.api.ExecutableId
97
98
import org.utbot.framework.plugin.api.FieldId
98
99
import org.utbot.framework.plugin.api.MethodId
99
100
import org.utbot.framework.plugin.api.TimeoutException
@@ -155,6 +156,7 @@ import org.utbot.framework.plugin.api.util.shortWrapperClassId
155
156
import org.utbot.framework.plugin.api.util.stringClassId
156
157
import org.utbot.framework.plugin.api.util.voidClassId
157
158
import org.utbot.framework.util.isUnit
159
+ import org.utbot.summary.SummarySentenceConstants.TAB
158
160
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
159
161
import java.lang.reflect.InvocationTargetException
160
162
import kotlin.reflect.jvm.javaType
@@ -396,13 +398,26 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
396
398
}
397
399
398
400
private fun writeWarningAboutFailureTest (exception : Throwable ) {
399
- + CgMultilineComment (
400
- listOf (
401
- " This test fails because executable under testing $currentExecutable " ,
402
- " produces Runtime exception $exception " ,
403
- )
404
- // TODO add stacktrace JIRA:1644
401
+ require(currentExecutable is ExecutableId )
402
+ val executableName = " ${currentExecutable!! .classId.name} .${currentExecutable!! .name} "
403
+
404
+ val warningLine = mutableListOf (
405
+ " This test fails because method [$executableName ] produces [$exception ]"
405
406
)
407
+
408
+ val neededStackTraceLines = mutableListOf<String >()
409
+ var executableCallFound = false
410
+ exception.stackTrace.reversed().forEach { stackTraceElement ->
411
+ val line = stackTraceElement.toString()
412
+ if (line.startsWith(executableName)) {
413
+ executableCallFound = true
414
+ }
415
+ if (executableCallFound) {
416
+ neededStackTraceLines + = TAB + line
417
+ }
418
+ }
419
+
420
+ + CgMultilineComment (warningLine + neededStackTraceLines.reversed())
406
421
}
407
422
408
423
private fun writeWarningAboutCrash () {
0 commit comments