From 82993c1a85455534084f05878fd00541071ee7b9 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 19 Oct 2022 18:41:58 +0200 Subject: [PATCH] PackageCurationTest: Test applicability with an empty name / version This is in context of [1]. [1]: https://github.com/oss-review-toolkit/ort/issues/5105#issuecomment-1108228824 Signed-off-by: Sebastian Schuberth --- model/src/test/kotlin/PackageCurationTest.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/model/src/test/kotlin/PackageCurationTest.kt b/model/src/test/kotlin/PackageCurationTest.kt index 1402f3f2623f..26d198d6263a 100644 --- a/model/src/test/kotlin/PackageCurationTest.kt +++ b/model/src/test/kotlin/PackageCurationTest.kt @@ -19,6 +19,7 @@ package org.ossreviewtoolkit.model +import io.kotest.assertions.assertSoftly import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.WordSpec import io.kotest.matchers.collections.containExactlyInAnyOrder @@ -409,6 +410,24 @@ class PackageCurationTest : WordSpec({ } "isApplicable()" should { + "accept an empty name and / or version" { + val curation = PackageCuration( + id = Identifier("Maven:com.android.tools"), + + // Hint: Curation data could set authors and a concluded license here to implement the concept of a + // "trusted framework" (as [identified][id] by only the type and namespace) with + // [ScannerConfiguration.skipConcluded] enabled. + data = PackageCurationData() + ) + + assertSoftly { + curation.isApplicable(Identifier("Maven:com.android.tools:common:25.3.0")) shouldBe true + curation.isApplicable(Identifier("Maven:com.android.tools:common")) shouldBe true + curation.isApplicable(Identifier("Maven:com.android.tools::25.3.0")) shouldBe true + curation.isApplicable(Identifier("Maven:com.android.tools")) shouldBe true + } + } + "comply to the ivy version matchers specifications" { packageCurationForVersion("[1.0.0,2.0.0]").isApplicable(identifierForVersion("1.0.0")) shouldBe true packageCurationForVersion("[1.0.0,2.0.0]").isApplicable(identifierForVersion("1.23")) shouldBe true