use of io.cucumber.spring.beans.GlueScopedComponent in project cucumber-jvm by cucumber.
the class SpringFactoryTest method shouldThrowWhenGlueScopedSpringBeanAreUsedOutsideLifecycle.
@Test
void shouldThrowWhenGlueScopedSpringBeanAreUsedOutsideLifecycle() {
final ObjectFactory factory = new SpringFactory();
factory.addClass(WithSpringAnnotations.class);
factory.start();
final Belly belly = factory.getInstance(Belly.class);
final GlueScopedComponent glue = factory.getInstance(GlueScopedComponent.class);
factory.stop();
assertDoesNotThrow(belly::getInstanceId);
assertThrows(BeanCreationException.class, glue::getInstanceId);
}
Aggregations