use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldRespectCommonAnnotationsInStepDefs.
@Test
public void shouldRespectCommonAnnotationsInStepDefs() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(WithSpringAnnotations.class);
factory.start();
WithSpringAnnotations stepdef = factory.getInstance(WithSpringAnnotations.class);
factory.stop();
assertNotNull(stepdef);
assertTrue(stepdef.isAutowired());
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldFindStepDefsCreatedImplicitlyForAutowiring.
@Test
public void shouldFindStepDefsCreatedImplicitlyForAutowiring() {
final ObjectFactory factory1 = new SpringFactory();
factory1.addClass(WithSpringAnnotations.class);
factory1.addClass(OneStepDef.class);
factory1.addClass(ThirdStepDef.class);
factory1.addClass(AutowiresThirdStepDef.class);
factory1.start();
final OneStepDef o1 = factory1.getInstance(OneStepDef.class);
final ThirdStepDef o2 = factory1.getInstance(ThirdStepDef.class);
factory1.stop();
assertNotNull(o1.getThirdStepDef());
assertNotNull(o2);
assertSame(o1.getThirdStepDef(), o2);
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldAllowClassesWithSameSpringAnnotations.
@Test
public void shouldAllowClassesWithSameSpringAnnotations() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(WithSpringAnnotations.class);
factory.addClass(BellyStepdefs.class);
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldRespectCustomPropertyPlaceholderConfigurer.
@Test
public void shouldRespectCustomPropertyPlaceholderConfigurer() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(WithSpringAnnotations.class);
factory.start();
WithSpringAnnotations stepdef = factory.getInstance(WithSpringAnnotations.class);
factory.stop();
assertEquals("property value", stepdef.getProperty());
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class PicoFactoryTest method shouldDisposeOnStop.
@Test
public void shouldDisposeOnStop() {
// Given
ObjectFactory factory = new PicoFactory();
factory.addClass(StepDefs.class);
// When
factory.start();
StepDefs steps = factory.getInstance(StepDefs.class);
// Then
assertFalse(steps.getBelly().isDisposed());
// When
factory.stop();
// Then
assertTrue(steps.getBelly().isDisposed());
}
Aggregations