Class AbstractGuiceFactory

  • All Implemented Interfaces:
    io.cucumber.core.backend.Container, io.cucumber.core.backend.Lookup, io.cucumber.core.backend.ObjectFactory

    public class AbstractGuiceFactory
    extends Object
    implements io.cucumber.core.backend.ObjectFactory
    Base class for implementing a custom ObjectFactory for cucumber tests and is based on the basic GuiceFactory implementation which can't be extended. That implementation works well when there is only single World implementation to test or if the requirements are such that system properties or environment variables can otherwise suffice in controlling the test environment to the provider's satisfaction. In other cases, it may simply be easier to create a custom ObjectFactory from this class, register it in META-INF/services/io.cucumber.core.backend.ObjectFactory and then reference it directly in the CucumberOptions annotation for the test class.
    • Constructor Detail

      • AbstractGuiceFactory

        protected AbstractGuiceFactory​(com.google.inject.Injector injector)
    • Method Detail

      • addClass

        public boolean addClass​(Class<?> clazz)
        Specified by:
        addClass in interface io.cucumber.core.backend.Container
      • start

        public void start()
        Specified by:
        start in interface io.cucumber.core.backend.ObjectFactory
      • stop

        public void stop()
        Specified by:
        stop in interface io.cucumber.core.backend.ObjectFactory
      • getInstance

        public <T> T getInstance​(Class<T> clazz)
        Specified by:
        getInstance in interface io.cucumber.core.backend.Lookup