use of io.cucumber.spring.commonglue.AutowiresThirdStepDef in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldReuseStepDefsCreatedImplicitlyForAutowiring.
@Test
void shouldReuseStepDefsCreatedImplicitlyForAutowiring() {
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 AutowiresThirdStepDef o3 = factory1.getInstance(AutowiresThirdStepDef.class);
factory1.stop();
assertAll(() -> assertThat(o1.getThirdStepDef(), is(notNullValue())), () -> assertThat(o3.getThirdStepDef(), is(notNullValue())), () -> assertThat(o1.getThirdStepDef(), is(equalTo(o3.getThirdStepDef()))), () -> assertThat(o3.getThirdStepDef(), is(equalTo(o1.getThirdStepDef()))));
}
Aggregations