use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldRespectDirtiesContextAnnotationsInStepDefsUsingMetaConfiguration.
@Test
public void shouldRespectDirtiesContextAnnotationsInStepDefsUsingMetaConfiguration() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(DirtiesContextBellyMetaStepDefs.class);
// Scenario 1
factory.start();
final BellyBean o1 = factory.getInstance(DirtiesContextBellyMetaStepDefs.class).getBellyBean();
factory.stop();
// Scenario 2
factory.start();
final BellyBean o2 = factory.getInstance(DirtiesContextBellyMetaStepDefs.class).getBellyBean();
factory.stop();
assertNotNull(o1);
assertNotNull(o2);
assertNotSame(o1, o2);
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldRespectDirtiesContextAnnotationsInStepDefs.
@Test
public void shouldRespectDirtiesContextAnnotationsInStepDefs() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(DirtiesContextBellyStepDefs.class);
// Scenario 1
factory.start();
final BellyBean o1 = factory.getInstance(DirtiesContextBellyStepDefs.class).getBellyBean();
factory.stop();
// Scenario 2
factory.start();
final BellyBean o2 = factory.getInstance(DirtiesContextBellyStepDefs.class).getBellyBean();
factory.stop();
assertNotNull(o1);
assertNotNull(o2);
assertNotSame(o1, o2);
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldGiveUsNewInstancesOfGlueScopeClassesForEachScenario.
@Test
public void shouldGiveUsNewInstancesOfGlueScopeClassesForEachScenario() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(BellyStepdefs.class);
factory.addClass(AutowiresPlatformTransactionManager.class);
// Scenario 1
factory.start();
final PlatformTransactionManager o1 = factory.getInstance(AutowiresPlatformTransactionManager.class).getTransactionManager();
factory.stop();
// Scenario 2
factory.start();
final PlatformTransactionManager o2 = factory.getInstance(AutowiresPlatformTransactionManager.class).getTransactionManager();
factory.stop();
assertNotNull(o1);
assertNotNull(o2);
assertNotSame(o1, o2);
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldNeverCreateNewApplicationBeanInstancesUsingMetaConfiguration.
@Test
public void shouldNeverCreateNewApplicationBeanInstancesUsingMetaConfiguration() {
// Feature 1
final ObjectFactory factory1 = new SpringFactory();
factory1.addClass(BellyMetaStepdefs.class);
factory1.start();
final BellyBean o1 = factory1.getInstance(BellyMetaStepdefs.class).getBellyBean();
factory1.stop();
// Feature 2
final ObjectFactory factory2 = new SpringFactory();
factory2.addClass(BellyMetaStepdefs.class);
factory2.start();
final BellyBean o2 = factory2.getInstance(BellyMetaStepdefs.class).getBellyBean();
factory2.stop();
assertNotNull(o1);
assertNotNull(o2);
assertSame(o1, o2);
}
use of cucumber.api.java.ObjectFactory in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldRespectContextHierarchyInStepDefs.
@Test
public void shouldRespectContextHierarchyInStepDefs() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(WithContextHierarchyAnnotation.class);
factory.start();
WithContextHierarchyAnnotation stepdef = factory.getInstance(WithContextHierarchyAnnotation.class);
factory.stop();
assertNotNull(stepdef);
assertTrue(stepdef.isAutowired());
}
Aggregations