Skip to content

Commit

Permalink
PackageCurationTest: Test applicability with an empty name / version
Browse files Browse the repository at this point in the history
This is in context of [1].

[1]: #5105 (comment)

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
  • Loading branch information
sschuberth committed Oct 20, 2022
1 parent fee548f commit bdc2f9c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions model/src/test/kotlin/PackageCurationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bdc2f9c

Please sign in to comment.