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 <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Nov 28, 2023
1 parent 6bc8c31 commit 665aa87
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({

Check warning on line 29 in plugins/commands/requirements/src/funTest/kotlin/RequirementsCommandFunTest.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused symbol

Class "RequirementsCommandFunTest" is never used
"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 665aa87

Please sign in to comment.