Skip to content

Commit

Permalink
Cleanup AbstractExchangeRateProviderTest
Browse files Browse the repository at this point in the history
  • Loading branch information
alvasw committed Sep 4, 2023
1 parent 6dd9755 commit b2c5cab
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ private void checkProviderCurrencyPairs(ExchangeRateProvider exchangeProvider, S
.collect(Collectors.toSet());

Set<String> supportedFiatCurrenciesRetrieved = exchangeProvider.getSupportedFiatCurrencies().stream()
.filter(f -> retrievedRatesCurrencies.contains(f))
.filter(retrievedRatesCurrencies::contains)
.collect(Collectors.toCollection(TreeSet::new));
log.info("Retrieved rates for supported fiat currencies: " + supportedFiatCurrenciesRetrieved);

Set<String> supportedCryptoCurrenciesRetrieved = exchangeProvider.getSupportedCryptoCurrencies().stream()
.filter(c -> retrievedRatesCurrencies.contains(c))
.filter(retrievedRatesCurrencies::contains)
.collect(Collectors.toCollection(TreeSet::new));
log.info("Retrieved rates for supported altcoins: " + supportedCryptoCurrenciesRetrieved);

Set<String> supportedCurrencies = Sets.union(
exchangeProvider.getSupportedCryptoCurrencies(),
exchangeProvider.getSupportedFiatCurrencies());

Set unsupportedCurrencies = Sets.difference(retrievedRatesCurrencies, supportedCurrencies);
Set<String> unsupportedCurrencies = Sets.difference(retrievedRatesCurrencies, supportedCurrencies);
assertTrue(unsupportedCurrencies.isEmpty(),
"Retrieved exchange rates contain unsupported currencies: " + unsupportedCurrencies);
}
Expand Down

0 comments on commit b2c5cab

Please sign in to comment.