PortofolioService { public List<Symbol> getAvailableSymbols(String login) { PortofolioEntity portofolio = portofolioRepo.findByUserUsername(login); List<SymbolEntity> ownedCurrencies = portofolio.getCurrencies(); List<SymbolEntity> ownedAssets = portofolio.getAssets().stream().map(a -> a.getSymbol()).collect(toList()); BooleanExpression exp = symbolEntity.notIn(ownedAssets) .and(symbolEntity.notIn(ownedCurrencies)) .and(symbolEntity.currency.in(ownedCurrencies) .and(symbolEntity.code.in(select(pairEntity.source.code).from(pairEntity))) .or(symbolEntity.currency.isNull())); return symbolMapper.mapToSymbols(symbolRepo.findAll(exp, symbolEntity.code.asc())); }  Portofolio createPortofolio(String login, String baseCurrencyCode, int baseCurrencyAmount); AssetInfo getBaseCurrency(String login); Portofolio getPortofolio(String login); OrderInfo getOrderInfo(String login, String symbolCode, double quantity); List<Symbol> getAvailableSymbols(String login); Order buy(String login, String code, double quantity); Order sell(String login, String code, double quantity);  }
@Test public void testGetAvailableSymbols_Toto() { String login = "toto"; List<Symbol> symbols = portofolioService.getAvailableSymbols(login); assertThat(symbols).extracting("code").containsExactly("RR", "UBI", USD); }