@@ -94,6 +94,7 @@ import org.utbot.framework.plugin.api.ClassId
9494import org.utbot.framework.plugin.api.CodegenLanguage
9595import org.utbot.framework.plugin.api.ConcreteExecutionFailureException
9696import org.utbot.framework.plugin.api.ConstructorId
97+ import org.utbot.framework.plugin.api.ExecutableId
9798import org.utbot.framework.plugin.api.FieldId
9899import org.utbot.framework.plugin.api.MethodId
99100import org.utbot.framework.plugin.api.TimeoutException
@@ -155,6 +156,7 @@ import org.utbot.framework.plugin.api.util.shortWrapperClassId
155156import org.utbot.framework.plugin.api.util.stringClassId
156157import org.utbot.framework.plugin.api.util.voidClassId
157158import org.utbot.framework.util.isUnit
159+ import org.utbot.summary.SummarySentenceConstants.TAB
158160import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
159161import java.lang.reflect.InvocationTargetException
160162import kotlin.reflect.jvm.javaType
@@ -396,13 +398,26 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
396398 }
397399
398400 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 ]"
405406 )
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())
406421 }
407422
408423 private fun writeWarningAboutCrash () {
0 commit comments