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

spock.genesis.generators.FactoryGenerator.groovy Maven / Gradle / Ivy

Go to download

Mostly lazy data generators for property based testing using the Spock test framework

The newest version!
package spock.genesis.generators

import groovy.transform.CompileStatic

/**
 * A infinite generator that returns the results of invoking a Closure
 * @param < T >   the generated type
 */
@CompileStatic
class FactoryGenerator extends InfiniteGenerator {

    final Closure factory

    FactoryGenerator(Closure factory) {
        this.factory = factory
    }

    @Override
    InfiniteIterator iterator() {
        new InfiniteIterator() {
            @Override
            T next() {
                factory.call()
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy