doReturn(StrategyPriority.HIGHEST).when(highestStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class));
List<DataMotionStrategy> strategies = new ArrayList<DataMotionStrategy>(5);
DataMotionStrategy strategy = null;
StorageStrategyFactoryImpl factory = new StorageStrategyFactoryImpl();
factory.setDataMotionStrategies(strategies);
strategies.add(cantHandleStrategy);
strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
assertEquals("A strategy was found when it shouldn't have been.", null, strategy);
strategies.add(defaultStrategy);
strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
assertEquals("Default strategy was not picked.", defaultStrategy, strategy);
strategies.add(hyperStrategy);
strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
assertEquals("Hypervisor strategy was not picked.", hyperStrategy, strategy);
strategies.add(pluginStrategy);
strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
assertEquals("Plugin strategy was not picked.", pluginStrategy, strategy);
strategies.add(highestStrategy);
strategy = factory.getDataMotionStrategy(mock(Map.class), mock(Host.class), mock(Host.class));
assertEquals("Highest strategy was not picked.", highestStrategy, strategy);
}