@@ -207,7 +207,7 @@ class SarifReport(
207
207
208
208
// prepending stack trace by `method` call in generated tests
209
209
val methodCallLocation: SarifPhysicalLocation ? =
210
- findMethodCallInTestBody(utExecution.testMethodName, method.name)
210
+ findMethodCallInTestBody(utExecution.testMethodName, method.name, utExecution )
211
211
if (methodCallLocation != null ) {
212
212
val testFileName = sourceFinding.testsRelativePath.toPath().fileName
213
213
val testClassName = testFileName.nameWithoutExtension
@@ -255,9 +255,15 @@ class SarifReport(
255
255
generatedTestsCode.split(' \n ' )
256
256
}
257
257
258
- private fun findMethodCallInTestBody (testMethodName : String? , methodName : String ): SarifPhysicalLocation ? {
258
+ private fun findMethodCallInTestBody (
259
+ testMethodName : String? ,
260
+ methodName : String ,
261
+ utExecution : UtExecution ,
262
+ ): SarifPhysicalLocation ? {
259
263
if (testMethodName == null )
260
264
return null
265
+ if (utExecution.result is UtSandboxFailure ) // if there is no method call in test
266
+ return getRelatedLocations(utExecution).firstOrNull()?.physicalLocation
261
267
262
268
// searching needed test
263
269
val testMethodStartsAt = testsBodyLines.indexOfFirst { line ->
@@ -342,6 +348,7 @@ class SarifReport(
342
348
val implicitlyThrown = result is UtImplicitlyThrownException
343
349
val overflowFailure = result is UtOverflowFailure && UtSettings .treatOverflowAsError
344
350
val assertionError = result is UtExplicitlyThrownException && result.exception is AssertionError
345
- return implicitlyThrown || overflowFailure || assertionError
351
+ val sandboxFailure = result is UtSandboxFailure
352
+ return implicitlyThrown || overflowFailure || assertionError || sandboxFailure
346
353
}
347
354
}
0 commit comments