All Downloads are FREE. Search and download functionalities are using the official Maven repository.

autoparams.kotlin.EnumAutoKotlinArgumentsProvider.kt Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 8.3.0
Show newest version
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
            )
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy