autoparams.kotlin.EnumAutoKotlinArgumentsProvider.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autoparams-kotlin Show documentation
Show all versions of autoparams-kotlin Show documentation
A Kotlin-specific addition to the AutoParams library, allowing for the automated generation of random parameters for unit testing in Kotlin. This extension is designed to leverage Kotlin's unique features for more powerful and flexible test data generation.
package autoparams.kotlin
import java.util.stream.Stream
import autoparams.EnumAutoArgumentsProvider
import autoparams.EnumAutoSource
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.ArgumentsProvider
import org.junit.jupiter.params.support.AnnotationConsumer
class EnumAutoKotlinArgumentsProvider :
ArgumentsProvider,
AnnotationConsumer {
private val provider = EnumAutoArgumentsProvider()
override fun provideArguments(
context: ExtensionContext
): Stream = provider.provideArguments(context)
override fun accept(annotation: EnumAutoKotlinSource) {
provider.accept(
EnumAutoSource.ProxyFactory.create(
annotation.value.java,
annotation.names,
annotation.mode
)
)
}
}