I have implemented a programm with the strategy pattern. So I have an interface which is used at some places and the concrete implementation may be replaced.
Now I
You have several options. If you are using Guice, here is a very straightforward way to inject your implementation.
If not, you can use a mix of factories and data provider:
@Factory(dataProvider = "dp")
public FactoryDataProviderSampleTest(StrategyInterface si) {
}
@DataProvider
static public Object[][] dp() {
return new Object[][] {
new Object[] { new Strategy1Impl() },
new Object[] { new Strategy2Impl() },
};
}