Skip to content

Add sandbox failures to SARIF report (#1276) #1364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add unit test
  • Loading branch information
mmvpm committed Nov 14, 2022
commit 74d6ac2e79f71cee12797a86bc03158a8d9c992f
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ package org.utbot.sarif

import org.junit.Test
import org.mockito.Mockito
import org.utbot.framework.plugin.api.ExecutableId
import org.utbot.framework.plugin.api.UtExecution
import org.utbot.framework.plugin.api.UtImplicitlyThrownException
import org.utbot.framework.plugin.api.UtPrimitiveModel
import org.utbot.framework.plugin.api.UtMethodTestSet
import org.utbot.framework.plugin.api.UtSymbolicExecution
import org.utbot.framework.plugin.api.*

class SarifReportTest {

Expand Down Expand Up @@ -137,6 +132,19 @@ class SarifReportTest {
}
}

@Test
fun testProcessSandboxFailure() {
mockUtMethodNames()

val uncheckedException = Mockito.mock(java.security.AccessControlException::class.java)
Mockito.`when`(uncheckedException.stackTrace).thenReturn(arrayOf())
Mockito.`when`(mockUtExecution.result).thenReturn(UtSandboxFailure(uncheckedException))

val report = sarifReportMain.createReport()
val result = report.runs.first().results.first()
assert(result.message.text.contains("AccessControlException"))
}

@Test
fun testCodeFlowsStartsWithMethodCall() {
mockUtMethodNames()
Expand Down