
com.wesleyhome.test.jupiter.provider.EnumParameterDataProvider.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit-jupiter-params-generated Show documentation
Show all versions of junit-jupiter-params-generated Show documentation
Library to help generate test parameter permutations for parameterized tests in JUnit.
This version is an initial attempt to convert to building with Gradle.
package com.wesleyhome.test.jupiter.provider
import kotlin.reflect.full.isSubclassOf
object EnumParameterDataProvider : ParameterDataProvider> {
override fun providesDataFor(testParameter: TestParameter): Boolean {
return testParameter.type.isSubclassOf(Enum::class)
}
override fun createParameterOptionsData(testParameter: TestParameter): List?> {
return testParameter.type.java.enumConstants.map { it as Enum<*> }.let {
if (testParameter.isNullable) {
it + null
} else {
it
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy