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

com.tngtech.jgiven.integration.spring.InternalSpringScenarioTest Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
package com.tngtech.jgiven.integration.spring;

import org.junit.ClassRule;
import org.junit.Rule;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;

import com.tngtech.jgiven.base.ScenarioTestBase;
import com.tngtech.jgiven.impl.ScenarioExecutor;
import com.tngtech.jgiven.impl.StageCreator;

/**
 * Internal class necessary in order to provide the correct ordering of the {@link org.junit.rules.MethodRule}s. Must be public because of
 * {@link SpringMethodRule}s validations.
 * It should not be used directly. Instead, use {@link SpringRuleScenarioTest}.
 *
 * @param 
 * @param 
 * @param 
 *
 * @since 0.13.0
 */
public abstract class InternalSpringScenarioTest extends ScenarioTestBase implements BeanFactoryAware {

    @ClassRule
    public static final SpringClassRule springClassRule = new SpringClassRule();

    @Rule
    public final SpringMethodRule springMethodRule = new SpringMethodRule();

    InternalSpringScenarioTest() {
    }

    public void setBeanFactory(BeanFactory beanFactory) {
        this.getScenario().getExecutor().setStageCreator((StageCreator) beanFactory.getBean( SpringStageCreator.class ));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy