Search in sources :

Example 1 with ThirdStepDef

use of io.cucumber.spring.commonglue.ThirdStepDef in project cucumber-jvm by cucumber.

the class SpringFactoryTest method shouldFindStepDefsCreatedImplicitlyForAutowiring.

@Test
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();
    assertAll(() -> assertThat(o1.getThirdStepDef(), is(notNullValue())), () -> assertThat(o2, is(notNullValue())), () -> assertThat(o1.getThirdStepDef(), is(equalTo(o2))), () -> assertThat(o2, is(equalTo(o1.getThirdStepDef()))));
}
Also used : OneStepDef(io.cucumber.spring.commonglue.OneStepDef) ObjectFactory(io.cucumber.core.backend.ObjectFactory) ThirdStepDef(io.cucumber.spring.commonglue.ThirdStepDef) AutowiresThirdStepDef(io.cucumber.spring.commonglue.AutowiresThirdStepDef) Test(org.junit.jupiter.api.Test)

Aggregations

ObjectFactory (io.cucumber.core.backend.ObjectFactory)1 AutowiresThirdStepDef (io.cucumber.spring.commonglue.AutowiresThirdStepDef)1 OneStepDef (io.cucumber.spring.commonglue.OneStepDef)1 ThirdStepDef (io.cucumber.spring.commonglue.ThirdStepDef)1 Test (org.junit.jupiter.api.Test)1