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

autoparams.kotlin.KotlinConstructorExtractor.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.lang.reflect.Constructor
import autoparams.generator.ConstructorExtractor
import kotlin.reflect.jvm.kotlinFunction

internal class KotlinConstructorExtractor : ConstructorExtractor {

    override fun extract(type: Class<*>): MutableCollection> {
        return type
            .constructors
            .filter { it.parameterCount > 0 || it.kotlinFunction != null }
            .toMutableList()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy