@Test public void whenGetCalledThenReturnExchangeConfig() { expect( ConfigurationManager.loadConfig( eq(ExchangeType.class), eq(EXCHANGE_CONFIG_YAML_FILENAME))) .andReturn(someInternalExchangeConfig()); PowerMock.replayAll(); final ExchangeConfigRepository exchangeConfigRepository = new ExchangeConfigYamlRepository(); final ExchangeConfig exchangeConfig = exchangeConfigRepository.get(); assertThat(exchangeConfig.getName()).isEqualTo(EXCHANGE_NAME); assertThat(exchangeConfig.getAdapter()).isEqualTo(EXCHANGE_ADAPTER); assertThat(exchangeConfig.getAuthenticationConfig().get(API_KEY_CONFIG_ITEM_KEY)) .isEqualTo(API_KEY_CONFIG_ITEM_VALUE); assertThat(exchangeConfig.getAuthenticationConfig().get(SECRET_CONFIG_ITEM_KEY)) .isEqualTo(SECRET_CONFIG_ITEM_VALUE); assertThat(exchangeConfig.getNetworkConfig().getConnectionTimeout()) .isEqualTo(CONNECTION_TIMEOUT); assertThat(exchangeConfig.getNetworkConfig().getNonFatalErrorCodes()) .isEqualTo(NON_FATAL_ERROR_CODES); assertThat(exchangeConfig.getNetworkConfig().getNonFatalErrorMessages()) .isEqualTo(NON_FATAL_ERROR_MESSAGES); assertThat(exchangeConfig.getOtherConfig().get(BUY_FEE_CONFIG_ITEM_KEY)) .isEqualTo(BUY_FEE_CONFIG_ITEM_VALUE); assertThat(exchangeConfig.getOtherConfig().get(SELL_FEE_CONFIG_ITEM_KEY)) .isEqualTo(SELL_FEE_CONFIG_ITEM_VALUE); PowerMock.verifyAll(); }
@Override public ExchangeConfig get() { LOG.info(() -> "Fetching ExchangeConfig..."); return ConfigurationManager.loadConfig(ExchangeType.class, EXCHANGE_CONFIG_YAML_FILENAME) .getExchange(); }
ExchangeConfigYamlRepository implements ExchangeConfigRepository { @Override public ExchangeConfig get() { LOG.info(() -> "Fetching ExchangeConfig..."); return ConfigurationManager.loadConfig(ExchangeType.class, EXCHANGE_CONFIG_YAML_FILENAME) .getExchange(); } }
ExchangeConfigYamlRepository implements ExchangeConfigRepository { @Override public ExchangeConfig get() { LOG.info(() -> "Fetching ExchangeConfig..."); return ConfigurationManager.loadConfig(ExchangeType.class, EXCHANGE_CONFIG_YAML_FILENAME) .getExchange(); }  }
ExchangeConfigYamlRepository implements ExchangeConfigRepository { @Override public ExchangeConfig get() { LOG.info(() -> "Fetching ExchangeConfig..."); return ConfigurationManager.loadConfig(ExchangeType.class, EXCHANGE_CONFIG_YAML_FILENAME) .getExchange(); }  @Override ExchangeConfig get(); @Override ExchangeConfig save(ExchangeConfig config); }
ExchangeConfigYamlRepository implements ExchangeConfigRepository { @Override public ExchangeConfig get() { LOG.info(() -> "Fetching ExchangeConfig..."); return ConfigurationManager.loadConfig(ExchangeType.class, EXCHANGE_CONFIG_YAML_FILENAME) .getExchange(); }  @Override ExchangeConfig get(); @Override ExchangeConfig save(ExchangeConfig config);  }