Skip to content

Commit

Permalink
test(scanner): Improve tests for ScannerWrapperConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Nonnenmacher <[email protected]>
  • Loading branch information
mnonnenmacher committed Nov 15, 2023
1 parent 1599731 commit f514519
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scanner/src/test/kotlin/ScannerWrapperConfigTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

package org.ossreviewtoolkit.scanner

import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.WordSpec
import io.kotest.inspectors.forAll
import io.kotest.matchers.maps.shouldContainExactly
import io.kotest.matchers.shouldBe

Expand Down Expand Up @@ -59,5 +61,20 @@ class ScannerWrapperConfigTest : WordSpec({

ScannerWrapperConfig.create(options).second shouldContainExactly mapOf("other" to "value")
}

"set storage properties not contained in the options map to null" {
with(ScannerWrapperConfig.create(emptyMap()).first) {
readFromStorage shouldBe null
writeToStorage shouldBe null
}
}

"fail if storage options are invalid" {
listOf("1", "tru", "null").forAll {
shouldThrow<IllegalArgumentException> {
ScannerWrapperConfig.create(mapOf(ScannerWrapperConfig.PROP_READ_FROM_STORAGE to it))
}
}
}
}
})

0 comments on commit f514519

Please sign in to comment.