use of io.cucumber.spring.beans.BellyBean in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldRespectDirtiesContextAnnotationsInStepDefsUsingMetaConfiguration.
@Test
void shouldRespectDirtiesContextAnnotationsInStepDefsUsingMetaConfiguration() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(DirtiesContextBellyMetaStepDefinitions.class);
// Scenario 1
factory.start();
final BellyBean o1 = factory.getInstance(DirtiesContextBellyMetaStepDefinitions.class).getBellyBean();
factory.stop();
// Scenario 2
factory.start();
final BellyBean o2 = factory.getInstance(DirtiesContextBellyMetaStepDefinitions.class).getBellyBean();
factory.stop();
assertAll(() -> assertThat(o1, is(notNullValue())), () -> assertThat(o2, is(notNullValue())), () -> assertThat(o1, is(not(equalTo(o2)))), () -> assertThat(o2, is(not(equalTo(o1)))));
}
use of io.cucumber.spring.beans.BellyBean in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldNeverCreateNewApplicationBeanInstances.
@Test
void shouldNeverCreateNewApplicationBeanInstances() {
// Feature 1
final ObjectFactory factory1 = new SpringFactory();
factory1.addClass(BellyStepDefinitions.class);
factory1.start();
final BellyBean o1 = factory1.getInstance(BellyStepDefinitions.class).getBellyBean();
factory1.stop();
// Feature 2
final ObjectFactory factory2 = new SpringFactory();
factory2.addClass(BellyStepDefinitions.class);
factory2.start();
final BellyBean o2 = factory2.getInstance(BellyStepDefinitions.class).getBellyBean();
factory2.stop();
assertAll(() -> assertThat(o1, is(notNullValue())), () -> assertThat(o2, is(notNullValue())), () -> assertThat(o1, is(equalTo(o1))), () -> assertThat(o2, is(equalTo(o2))));
}
use of io.cucumber.spring.beans.BellyBean in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldRespectDirtiesContextAnnotationsInStepDefs.
@Test
void shouldRespectDirtiesContextAnnotationsInStepDefs() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(DirtiesContextBellyStepDefinitions.class);
// Scenario 1
factory.start();
final BellyBean o1 = factory.getInstance(DirtiesContextBellyStepDefinitions.class).getBellyBean();
factory.stop();
// Scenario 2
factory.start();
final BellyBean o2 = factory.getInstance(DirtiesContextBellyStepDefinitions.class).getBellyBean();
factory.stop();
assertAll(() -> assertThat(o1, is(notNullValue())), () -> assertThat(o2, is(notNullValue())), () -> assertThat(o1, is(not(equalTo(o2)))), () -> assertThat(o2, is(not(equalTo(o1)))));
}
use of io.cucumber.spring.beans.BellyBean in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldNeverCreateNewApplicationBeanInstancesUsingMetaConfiguration.
@Test
void shouldNeverCreateNewApplicationBeanInstancesUsingMetaConfiguration() {
// Feature 1
final ObjectFactory factory1 = new SpringFactory();
factory1.addClass(BellyMetaStepDefinitions.class);
factory1.start();
final BellyBean o1 = factory1.getInstance(BellyMetaStepDefinitions.class).getBellyBean();
factory1.stop();
// Feature 2
final ObjectFactory factory2 = new SpringFactory();
factory2.addClass(BellyMetaStepDefinitions.class);
factory2.start();
final BellyBean o2 = factory2.getInstance(BellyMetaStepDefinitions.class).getBellyBean();
factory2.stop();
assertAll(() -> assertThat(o1, is(notNullValue())), () -> assertThat(o2, is(notNullValue())), () -> assertThat(o1, is(equalTo(o1))), () -> assertThat(o2, is(equalTo(o2))));
}
Aggregations