diff --git a/model/src/test/kotlin/PackageCurationTest.kt b/model/src/test/kotlin/PackageCurationTest.kt index 1402f3f2623f4..3de4f05e4ca4d 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,27 @@ class PackageCurationTest : WordSpec({ } "isApplicable()" should { + "accept an empty name and / or version" { + val curation = PackageCuration( + id = Identifier("Maven:com.android.tools"), + + // Setting curation data is not required for the test, but demonstrates the idea of using an empty name + // and version in conjunction with setting authors and a concluded license to implement "trusted + // frameworks" if [ScannerConfiguration.skipConcluded] is enabled. + data = PackageCurationData( + authors = sortedSetOf("The Android Open Source Project"), + concludedLicense = "Apache-2.0".toSpdx() + ) + ) + + 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