Search in sources :

Example 1 with BellyStepDefinitions

use of io.cucumber.spring.contextconfig.BellyStepDefinitions in project cucumber-jvm by cucumber.

the class SpringFactoryTest method shouldGiveUsNewStepInstancesForEachScenario.

@Test
void shouldGiveUsNewStepInstancesForEachScenario() {
    final ObjectFactory factory = new SpringFactory();
    factory.addClass(BellyStepDefinitions.class);
    // Scenario 1
    factory.start();
    final BellyStepDefinitions o1 = factory.getInstance(BellyStepDefinitions.class);
    factory.stop();
    // Scenario 2
    factory.start();
    final BellyStepDefinitions o2 = factory.getInstance(BellyStepDefinitions.class);
    factory.stop();
    assertAll(() -> assertThat(o1, is(notNullValue())), () -> assertThat(o2, is(notNullValue())), () -> assertThat(o1, is(not(equalTo(o2)))), () -> assertThat(o2, is(not(equalTo(o1)))));
}
Also used : DirtiesContextBellyStepDefinitions(io.cucumber.spring.dirtiescontextconfig.DirtiesContextBellyStepDefinitions) BellyStepDefinitions(io.cucumber.spring.contextconfig.BellyStepDefinitions) ObjectFactory(io.cucumber.core.backend.ObjectFactory) Test(org.junit.jupiter.api.Test)

Aggregations

ObjectFactory (io.cucumber.core.backend.ObjectFactory)1 BellyStepDefinitions (io.cucumber.spring.contextconfig.BellyStepDefinitions)1 DirtiesContextBellyStepDefinitions (io.cucumber.spring.dirtiescontextconfig.DirtiesContextBellyStepDefinitions)1 Test (org.junit.jupiter.api.Test)1