MarketConfigYamlRepository implements MarketConfigRepository { @Override public List<MarketConfig> findAll() { LOG.info(() -> "Fetching all Market configs..."); return ConfigurationManager.loadConfig(MarketsType.class, MARKETS_CONFIG_YAML_FILENAME) .getMarkets(); }  @Override List<MarketConfig> findAll(); @Override MarketConfig findById(String id); @Override MarketConfig save(MarketConfig config); @Override MarketConfig delete(String id);  }
@Test public void whenFindAllCalledThenExpectServiceToReturnAllMarketConfigs() { expect(ConfigurationManager.loadConfig(eq(MarketsType.class), eq(MARKETS_CONFIG_YAML_FILENAME))) .andReturn(allTheInternalMarketsConfig()); PowerMock.replayAll(); final MarketConfigRepository marketConfigRepository = new MarketConfigYamlRepository(); final List<MarketConfig> marketConfigItems = marketConfigRepository.findAll(); assertThat(marketConfigItems.size()).isEqualTo(2); assertThat(marketConfigItems.get(0).getId()).isEqualTo(MARKET_1_ID); assertThat(marketConfigItems.get(0).getName()).isEqualTo(MARKET_1_NAME); assertThat(marketConfigItems.get(0).isEnabled()).isEqualTo(MARKET_1_IS_ENABLED); assertThat(marketConfigItems.get(0).getBaseCurrency()).isEqualTo(MARKET_1_BASE_CURRENCY); assertThat(marketConfigItems.get(0).getCounterCurrency()).isEqualTo(MARKET_1_COUNTER_CURRENCY); assertThat(marketConfigItems.get(0).getTradingStrategyId()) .isEqualTo(MARKET_1_TRADING_STRATEGY_ID); assertThat(marketConfigItems.get(1).getId()).isEqualTo(MARKET_2_ID); assertThat(marketConfigItems.get(1).getName()).isEqualTo(MARKET_2_NAME); assertThat(marketConfigItems.get(1).isEnabled()).isEqualTo(MARKET_2_IS_ENABLED); assertThat(marketConfigItems.get(1).getBaseCurrency()).isEqualTo(MARKET_2_BASE_CURRENCY); assertThat(marketConfigItems.get(1).getCounterCurrency()).isEqualTo(MARKET_2_COUNTER_CURRENCY); assertThat(marketConfigItems.get(1).getTradingStrategyId()) .isEqualTo(MARKET_2_TRADING_STRATEGY_ID); PowerMock.verifyAll(); }