Skip to content

Commit a890f2b

Browse files
committed
test(package-curation-providers): Be more strict about thrown exceptions
Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 3a655be commit a890f2b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

plugins/package-curation-providers/file/src/test/kotlin/FilePackageCurationProviderTest.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ import io.kotest.matchers.collections.shouldContainAll
2727
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
2828
import io.kotest.matchers.should
2929
import io.kotest.matchers.shouldBe
30+
import io.kotest.matchers.string.endWith
31+
import io.kotest.matchers.string.startWith
3032

3133
import java.io.File
34+
import java.io.IOException
3235

3336
import org.ossreviewtoolkit.model.Identifier
3437
import org.ossreviewtoolkit.model.Package
@@ -111,17 +114,17 @@ class FilePackageCurationProviderTest : StringSpec() {
111114
"Provider throws an exception if the curations file is not de-serializable" {
112115
val curationsFile = File("src/test/assets/package-curations-not-deserializable.yml")
113116

114-
shouldThrow<Exception> {
117+
shouldThrow<IOException> {
115118
FilePackageCurationProvider(curationsFile)
116-
}
119+
}.message should startWith("Failed parsing package curation(s)")
117120
}
118121

119122
"Provider throws an exception if the curations file does not exist" {
120123
val curationsFile = File("src/test/assets/package-curations-not-existing.yml")
121124

122-
shouldThrow<Exception> {
125+
shouldThrow<IllegalArgumentException> {
123126
FilePackageCurationProvider(curationsFile)
124-
}
127+
}.message should endWith("does not exist.")
125128
}
126129
}
127130
}

0 commit comments

Comments
 (0)