Search in sources :

Example 1 with ScalaContext

use of org.jbehave.core.configuration.scala.ScalaContext in project jbehave-core by jbehave.

the class ScalaStepsFactoryBehaviour method shouldNotCreateStepsInstancesFromScalaWhenNotFound.

@Test(expected = ScalaInstanceNotFound.class)
public void shouldNotCreateStepsInstancesFromScalaWhenNotFound() {
    ScalaStepsFactory factory = new ScalaStepsFactory(new MostUsefulConfiguration(), new ScalaContext());
    factory.createInstanceOfType(NonScalaType.class);
}
Also used : MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) ScalaContext(org.jbehave.core.configuration.scala.ScalaContext) Test(org.junit.Test)

Example 2 with ScalaContext

use of org.jbehave.core.configuration.scala.ScalaContext in project jbehave-core by jbehave.

the class ScalaStepsFactoryBehaviour method shouldCreateStepsInstancesFromScalaWhenAnnotated.

@Test
public void shouldCreateStepsInstancesFromScalaWhenAnnotated() {
    ScalaContext context = new ScalaContext("AnnotatedSteps", "NonAnnotatedSteps");
    ScalaStepsFactory factory = new ScalaStepsFactory(new MostUsefulConfiguration(), context);
    List<Class<?>> types = factory.stepsTypes();
    MatcherAssert.assertThat(types.size(), Matchers.equalTo(1));
    assertThat(types.get(0).getSimpleName(), equalTo("AnnotatedSteps"));
    Object object = factory.createInstanceOfType(context.newInstance("AnnotatedSteps").getClass());
    assertThat(object.getClass().getName(), equalTo("AnnotatedSteps"));
}
Also used : MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) ScalaContext(org.jbehave.core.configuration.scala.ScalaContext) Test(org.junit.Test)

Aggregations

MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)2 ScalaContext (org.jbehave.core.configuration.scala.ScalaContext)2 Test (org.junit.Test)2