Search in sources :

Example 1 with GroovyContext

use of org.jbehave.core.configuration.groovy.GroovyContext in project jbehave-core by jbehave.

the class GroovyStepsFactoryBehaviour method shouldNotCreateStepsInstancesFromGroovyWhenResourceInvalid.

@Test(expected = GroovyClassInstantiationFailed.class)
public void shouldNotCreateStepsInstancesFromGroovyWhenResourceInvalid() {
    GroovyStepsFactory factory = new GroovyStepsFactory(new MostUsefulConfiguration(), new GroovyContext(asList("/org/jbehave/core/steps/groovy/invalidSteps.groovy")));
    factory.stepsTypes();
}
Also used : MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) GroovyContext(org.jbehave.core.configuration.groovy.GroovyContext) Test(org.junit.Test)

Example 2 with GroovyContext

use of org.jbehave.core.configuration.groovy.GroovyContext in project jbehave-core by jbehave.

the class GroovyStepsFactoryBehaviour method shouldCreateStepsInstancesFromGroovyWhenAnnotated.

@Test
public void shouldCreateStepsInstancesFromGroovyWhenAnnotated() {
    GroovyResourceFinder resourceFinder = new GroovyResourceFinder(codeLocationFromClass(this.getClass()), "**/steps/groovy/*.groovy", "**/invalidSteps.groovy");
    GroovyStepsFactory factory = new GroovyStepsFactory(new MostUsefulConfiguration(), new GroovyContext(resourceFinder));
    List<Class<?>> types = factory.stepsTypes();
    MatcherAssert.assertThat(types.size(), Matchers.equalTo(1));
    assertThat(types.get(0).getSimpleName(), equalTo("AnnotatedSteps"));
}
Also used : GroovyResourceFinder(org.jbehave.core.configuration.groovy.GroovyResourceFinder) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) CodeLocations.codeLocationFromClass(org.jbehave.core.io.CodeLocations.codeLocationFromClass) GroovyContext(org.jbehave.core.configuration.groovy.GroovyContext) Test(org.junit.Test)

Aggregations

MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)2 GroovyContext (org.jbehave.core.configuration.groovy.GroovyContext)2 Test (org.junit.Test)2 GroovyResourceFinder (org.jbehave.core.configuration.groovy.GroovyResourceFinder)1 CodeLocations.codeLocationFromClass (org.jbehave.core.io.CodeLocations.codeLocationFromClass)1