@Test public void whenFindAllCalledThenExpectServiceToReturnAllStrategyConfigs() { expect( ConfigurationManager.loadConfig( eq(StrategiesType.class), eq(STRATEGIES_CONFIG_YAML_FILENAME))) .andReturn(allTheInternalStrategiesConfig()); PowerMock.replayAll(); final StrategyConfigRepository strategyConfigRepository = new StrategyConfigYamlRepository(); final List<StrategyConfig> strategyConfigItems = strategyConfigRepository.findAll(); assertThat(strategyConfigItems.size()).isEqualTo(2); assertThat(strategyConfigItems.get(0).getId()).isEqualTo(STRAT_ID_1); assertThat(strategyConfigItems.get(0).getName()).isEqualTo(STRAT_NAME_1); assertThat(strategyConfigItems.get(0).getDescription()).isEqualTo(STRAT_DESCRIPTION_1); assertThat(strategyConfigItems.get(0).getClassName()).isEqualTo(STRAT_CLASSNAME_1); assertThat(strategyConfigItems.get(0).getConfigItems().containsKey(BUY_PRICE_CONFIG_ITEM_KEY)) .isTrue(); assertThat( strategyConfigItems.get(0).getConfigItems().containsValue(BUY_PRICE_CONFIG_ITEM_VALUE)) .isTrue(); assertThat( strategyConfigItems.get(0).getConfigItems().containsKey(AMOUNT_TO_BUY_CONFIG_ITEM_KEY)) .isTrue(); assertThat( strategyConfigItems .get(0) .getConfigItems() .containsValue(AMOUNT_TO_BUY_CONFIG_ITEM_VALUE)) .isTrue(); assertThat(strategyConfigItems.get(1).getId()).isEqualTo(STRAT_ID_2); assertThat(strategyConfigItems.get(1).getName()).isEqualTo(STRAT_NAME_2); assertThat(strategyConfigItems.get(1).getDescription()).isEqualTo(STRAT_DESCRIPTION_2); assertThat(strategyConfigItems.get(1).getClassName()).isEqualTo(STRAT_CLASSNAME_2); assertThat(strategyConfigItems.get(1).getConfigItems().containsKey(BUY_PRICE_CONFIG_ITEM_KEY)) .isTrue(); assertThat( strategyConfigItems.get(1).getConfigItems().containsValue(BUY_PRICE_CONFIG_ITEM_VALUE)) .isTrue(); assertThat( strategyConfigItems.get(1).getConfigItems().containsKey(AMOUNT_TO_BUY_CONFIG_ITEM_KEY)) .isTrue(); assertThat( strategyConfigItems .get(1) .getConfigItems() .containsValue(AMOUNT_TO_BUY_CONFIG_ITEM_VALUE)) .isTrue(); PowerMock.verifyAll(); }
@Override public List<StrategyConfig> findAll() { LOG.info(() -> "Fetching all Strategy configs..."); return ConfigurationManager.loadConfig(StrategiesType.class, STRATEGIES_CONFIG_YAML_FILENAME) .getStrategies(); }
StrategyConfigYamlRepository implements StrategyConfigRepository { @Override public List<StrategyConfig> findAll() { LOG.info(() -> "Fetching all Strategy configs..."); return ConfigurationManager.loadConfig(StrategiesType.class, STRATEGIES_CONFIG_YAML_FILENAME) .getStrategies(); } }
StrategyConfigYamlRepository implements StrategyConfigRepository { @Override public List<StrategyConfig> findAll() { LOG.info(() -> "Fetching all Strategy configs..."); return ConfigurationManager.loadConfig(StrategiesType.class, STRATEGIES_CONFIG_YAML_FILENAME) .getStrategies(); }  }
StrategyConfigYamlRepository implements StrategyConfigRepository { @Override public List<StrategyConfig> findAll() { LOG.info(() -> "Fetching all Strategy configs..."); return ConfigurationManager.loadConfig(StrategiesType.class, STRATEGIES_CONFIG_YAML_FILENAME) .getStrategies(); }  @Override List<StrategyConfig> findAll(); @Override StrategyConfig findById(String id); @Override StrategyConfig save(StrategyConfig config); @Override StrategyConfig delete(String id); }
StrategyConfigYamlRepository implements StrategyConfigRepository { @Override public List<StrategyConfig> findAll() { LOG.info(() -> "Fetching all Strategy configs..."); return ConfigurationManager.loadConfig(StrategiesType.class, STRATEGIES_CONFIG_YAML_FILENAME) .getStrategies(); }  @Override List<StrategyConfig> findAll(); @Override StrategyConfig findById(String id); @Override StrategyConfig save(StrategyConfig config); @Override StrategyConfig delete(String id);  }