Skip to content

Commit

Permalink
test(core): Use a helper function in test
Browse files Browse the repository at this point in the history
This function will be used in the subsequent commit as well.

Signed-off-by: Johanna Lamppu <[email protected]>
  • Loading branch information
lamppu authored and sschuberth committed Dec 20, 2024
1 parent 594b5b1 commit 02adf04
Showing 1 changed file with 15 additions and 38 deletions.
53 changes: 15 additions & 38 deletions core/src/test/kotlin/api/ProductsRouteIntegrationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -985,16 +985,9 @@ class ProductsRouteIntegrationTest : AbstractIntegrationTest({
dbExtension.fixtures.createAdvisorRun(
advisorJob1Id,
mapOf(
identifier1 to
listOf(
AdvisorResult(
advisorName = "advisor",
capabilities = listOf("vulnerabilities"),
startTime = Clock.System.now(),
endTime = Clock.System.now(),
issues = emptyList(),
defects = emptyList(),
vulnerabilities = listOf(
identifier1 to listOf(
generateAdvisorResult(
listOf(
commonVulnerability,
run1Vulnerability
)
Expand All @@ -1019,34 +1012,8 @@ class ProductsRouteIntegrationTest : AbstractIntegrationTest({
dbExtension.fixtures.createAdvisorRun(
advisorJob3Id,
mapOf(
identifier1 to
listOf(
AdvisorResult(
advisorName = "advisor",
capabilities = listOf("vulnerabilities"),
startTime = Clock.System.now(),
endTime = Clock.System.now(),
issues = emptyList(),
defects = emptyList(),
vulnerabilities = listOf(
commonVulnerability
)
)
),
identifier2 to
listOf(
AdvisorResult(
advisorName = "advisor",
capabilities = listOf("vulnerabilities"),
startTime = Clock.System.now(),
endTime = Clock.System.now(),
issues = emptyList(),
defects = emptyList(),
vulnerabilities = listOf(
commonVulnerability
)
)
)
identifier1 to listOf(generateAdvisorResult(listOf(commonVulnerability))),
identifier2 to listOf(generateAdvisorResult(listOf(commonVulnerability)))
)
)

Expand Down Expand Up @@ -1099,3 +1066,13 @@ class ProductsRouteIntegrationTest : AbstractIntegrationTest({
}
}
})

private fun generateAdvisorResult(vulnerabilities: List<Vulnerability>) = AdvisorResult(
advisorName = "advisor",
capabilities = listOf("vulnerabilities"),
startTime = Clock.System.now(),
endTime = Clock.System.now(),
issues = emptyList(),
defects = emptyList(),
vulnerabilities = vulnerabilities
)

0 comments on commit 02adf04

Please sign in to comment.