Reputation: 11864
I want migrate cucumber.runtime.java.guice 1.1.1 to 1.2.4
In version 1.1.1 GuiceFactory take this value guiceModule=test.MyModule
in src\test\resources\cucumber-guice.properties
file but do not work in version 1.2.4.
This project is a good example (https://github.com/rapaul/cucumber-jvm-guice-examples) in version 1.1.1 but I need use 1.2.4 in my project.
public class MyModule implements Module {
@Override
public void configure(Binder binder) {
System.out.println("MyModule configure");
StepsInterceptor stepsInterceptor = new StepsInterceptor();
binder.bindInterceptor(any(), annotatedWith(SpeedRegulator.class), stepsInterceptor);
}
}
Please, how to use new version of GuiceFactory?
Upvotes: 1
Views: 141
Reputation: 11864
I find the solution:
step 1: create a class:
public class MyjectorSource implements InjectorSource {
@Override
public Injector getInjector() {
return Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO, new MyModule());
}
}
Step 2: in cucumber.properties file:
guice.injector-source=test.MyjectorSource
Upvotes: 1