@@ -21,6 +21,8 @@ package org.ossreviewtoolkit.plugins.packagecurationproviders.file
2121
2222import io.kotest.assertions.throwables.shouldThrow
2323import io.kotest.core.spec.style.StringSpec
24+ import io.kotest.engine.spec.tempdir
25+ import io.kotest.engine.spec.tempfile
2426import io.kotest.matchers.collections.beEmpty
2527import io.kotest.matchers.collections.haveSize
2628import io.kotest.matchers.collections.shouldContainAll
@@ -30,15 +32,19 @@ import io.kotest.matchers.shouldBe
3032import io.kotest.matchers.string.endWith
3133import io.kotest.matchers.string.startWith
3234
33- import java.io.File
3435import java.io.IOException
3536
3637import org.ossreviewtoolkit.model.Identifier
3738import org.ossreviewtoolkit.model.Package
39+ import org.ossreviewtoolkit.utils.common.extractResource
3840
3941class FilePackageCurationProviderTest : StringSpec () {
40- private val curationsDir = File (" src/test/assets/package-curations-dir" )
41- private val curationsFile = File (" src/test/assets/package-curations.yml" )
42+ private val curationsDir = tempdir().resolve(" package-curations-dir" ).also {
43+ extractResource(" /package-curations-dir/curations-1.yml" , it.resolve(" 1.yml" ))
44+ extractResource(" /package-curations-dir/nested/curations-2.yml" , it.resolve(" nested/2.yml" ))
45+ }
46+
47+ private val curationsFile = extractResource(" /package-curations.yml" , tempfile(suffix = " .yml" ))
4248
4349 init {
4450 " Provider can read YAML file" {
@@ -112,15 +118,15 @@ class FilePackageCurationProviderTest : StringSpec() {
112118 }
113119
114120 " Provider throws an exception if the curations file is not de-serializable" {
115- val curationsFile = File ( " src/test/assets/ package-curations-not-deserializable.yml" )
121+ val curationsFile = extractResource( " / package-curations-not-deserializable.yml" , tempfile(suffix = " .yml " ) )
116122
117123 shouldThrow<IOException > {
118124 FilePackageCurationProvider (curationsFile)
119125 }.message should startWith(" Failed parsing package curation(s)" )
120126 }
121127
122128 " Provider throws an exception if the curations file does not exist" {
123- val curationsFile = File ( " src/test/assets/ package-curations-not-existing.yml" )
129+ val curationsFile = tempdir().resolve( " package-curations-not-existing.yml" )
124130
125131 shouldThrow<IllegalArgumentException > {
126132 FilePackageCurationProvider (curationsFile)
0 commit comments