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

com.github.goldin.spock.extensions.testdir.TestDirExtension.groovy Maven / Gradle / Ivy

The newest version!
package com.github.goldin.spock.extensions.testdir

import org.gcontracts.annotations.Requires
import org.spockframework.runtime.extension.AbstractAnnotationDrivenExtension
import org.spockframework.runtime.model.FieldInfo


/**
 * {@link @TestDir} extension.
 */
class TestDirExtension extends AbstractAnnotationDrivenExtension
{
    @Override
    @Requires({ annotation && field })
    @SuppressWarnings([ 'UnnecessaryGetter', 'GroovyGetterCallCanBePropertyAccess' ])
    void visitFieldAnnotation ( TestDir annotation, FieldInfo field )
    {
        final interceptor = new TestDirInterceptor( annotation.baseDir(), annotation.clean(), field.name )
        field.parent.getTopSpec().setupMethod.addInterceptor( interceptor )
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy