Skip to content

Commit

Permalink
test(requirements): Add a test for core plugins to be found
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 28, 2023
1 parent fae8600 commit 8668fb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ package org.ossreviewtoolkit.plugins.commands.requirements
import com.github.ajalt.clikt.testing.test

import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.collections.beEmpty
import io.kotest.matchers.shouldNot
import io.kotest.matchers.shouldNotBe

class RequirementsCommandFunTest : StringSpec({
"All tool classes can be instantiated via reflection" {
// Status code 1 is only returned if there was an error while instantiating a class via reflection.
RequirementsCommand().test().statusCode shouldNotBe 1
}

"Core plugins are found" {
val plugins = RequirementsCommand().getPluginsByType()

plugins.keys shouldNot beEmpty()
plugins.values.flatten() shouldNot beEmpty()
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class RequirementsCommand : OrtCommand(
}
}

private fun getPluginsByType(): Map<String, Set<String>> {
internal fun getPluginsByType(): Map<String, Set<String>> {
val pluginClasses = reflections.getSubTypesOf(Plugin::class.java)

val pluginTypes = pluginClasses.mapNotNull { clazz ->
Expand Down

0 comments on commit 8668fb7

Please sign in to comment.