From faf772b0b607b44d90003497478208514d2fd8a9 Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Fri, 13 Dec 2024 10:53:52 +0100 Subject: [PATCH] test(oss-index): Use coordinates as keys Improve output of assertion failures within `forAll`. Signed-off-by: Frank Viernau --- .../oss-index/src/test/kotlin/OssIndexTest.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/advisors/oss-index/src/test/kotlin/OssIndexTest.kt b/plugins/advisors/oss-index/src/test/kotlin/OssIndexTest.kt index 4ff9275271da0..5d5f9277e1cf6 100644 --- a/plugins/advisors/oss-index/src/test/kotlin/OssIndexTest.kt +++ b/plugins/advisors/oss-index/src/test/kotlin/OssIndexTest.kt @@ -122,13 +122,15 @@ class OssIndexTest : WordSpec({ OssIndexConfiguration("http://localhost:${server.port()}", null, null) ) - val result = ossIndex.retrievePackageFindings(PACKAGES).mapKeys { it.key.id } - - result.keys shouldContainExactlyInAnyOrder PACKAGES.map { it.id } - result.forAll { (_, advisorResult) -> - advisorResult.advisor shouldBe ossIndex.details - advisorResult.vulnerabilities should beEmpty() - advisorResult.summary.issues shouldHaveSingleElement { it.severity == Severity.ERROR } + val result = ossIndex.retrievePackageFindings(PACKAGES).mapKeys { it.key.id.toCoordinates() } + + result.keys shouldContainExactlyInAnyOrder PACKAGES.map { it.id.toCoordinates() } + result.keys.forAll { coordinates -> + with(result.getValue(coordinates)) { + advisor shouldBe ossIndex.details + vulnerabilities should beEmpty() + summary.issues shouldHaveSingleElement { it.severity == Severity.ERROR } + } } }