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

spock.genesis.generators.ObjectIteratorGenerator.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

@CompileStatic
class ObjectIteratorGenerator extends Generator {
    private final Object object

    ObjectIteratorGenerator(object) {
        this.object = object
    }

    @Override
    UnmodifiableIterator iterator() {
        new UnmodifiableIterator() {
            final private Iterator iterator = object.iterator()
            @Override
            boolean hasNext() {
                iterator.hasNext()
            }

            @Override
            Object next() {
                iterator.next()
            }
        }
    }

    @Override
    boolean isFinite() { true }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy