when(select.selectSolution(null)).thenReturn(newSol);
final Collection<Integer> runs = new ArrayList<Integer>();
SearchStrategy strat = new SearchStrategy(select, accept, calc);
SearchStrategyModule mod = new SearchStrategyModule() {
@Override
public VehicleRoutingProblemSolution runAndGetSolution(VehicleRoutingProblemSolution vrpSolution) {
runs.add(1);
return vrpSolution;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
@Override
public void addModuleListener(
SearchStrategyModuleListener moduleListener) {
// TODO Auto-generated method stub
}
};
SearchStrategyModule mod2 = new SearchStrategyModule() {
@Override
public VehicleRoutingProblemSolution runAndGetSolution(VehicleRoutingProblemSolution vrpSolution) {
runs.add(1);
return vrpSolution;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
@Override
public void addModuleListener(
SearchStrategyModuleListener moduleListener) {
// TODO Auto-generated method stub
}
};
strat.addModule(mod);
strat.addModule(mod2);
strat.run(vrp, null);
assertEquals(runs.size(), 2);
}