@Test public void getAllPossibleTokens_throwsResourceNotFoundException_whenEmpty() { final String platform = "GITHUB"; final String platformId = "FundRequest|FR|area51|FR|3"; when(tokenWhitelistPreconditionContract.token(any(BigInteger.class))).thenReturn(Optional.empty()); try { fundRequestContractsService.getAllPossibleTokens(platform, platformId); fail("A ResourceNotFoundException should have been thrown"); } catch (ResourceNotFoundException e) { assertThat(e).isNotNull(); } }
@Cacheable(value = "possible_tokens", keyGenerator = "getAllPossibleTokensKeyGenerator") public List<TokenInfoDto> getAllPossibleTokens(final String platform, final String platformId) { return checkNotEmpty(getAllPossibleTokens().stream() .filter(token -> tokenWhitelistPreconditionContract.isValid(platform, platformId, token.getAddress())) .collect(Collectors.toList())); }
FundRequestContractsService { @Cacheable(value = "possible_tokens", keyGenerator = "getAllPossibleTokensKeyGenerator") public List<TokenInfoDto> getAllPossibleTokens(final String platform, final String platformId) { return checkNotEmpty(getAllPossibleTokens().stream() .filter(token -> tokenWhitelistPreconditionContract.isValid(platform, platformId, token.getAddress())) .collect(Collectors.toList())); } }
FundRequestContractsService { @Cacheable(value = "possible_tokens", keyGenerator = "getAllPossibleTokensKeyGenerator") public List<TokenInfoDto> getAllPossibleTokens(final String platform, final String platformId) { return checkNotEmpty(getAllPossibleTokens().stream() .filter(token -> tokenWhitelistPreconditionContract.isValid(platform, platformId, token.getAddress())) .collect(Collectors.toList())); } FundRequestContractsService(final FundRequestContract fundRequestContract,
                                       final TokenWhitelistPreconditionContract tokenWhitelistPreconditionContract,
                                       final Web3j web3j,
                                       final TokenInfoService tokenInfoService); }
FundRequestContractsService { @Cacheable(value = "possible_tokens", keyGenerator = "getAllPossibleTokensKeyGenerator") public List<TokenInfoDto> getAllPossibleTokens(final String platform, final String platformId) { return checkNotEmpty(getAllPossibleTokens().stream() .filter(token -> tokenWhitelistPreconditionContract.isValid(platform, platformId, token.getAddress())) .collect(Collectors.toList())); } FundRequestContractsService(final FundRequestContract fundRequestContract,
                                       final TokenWhitelistPreconditionContract tokenWhitelistPreconditionContract,
                                       final Web3j web3j,
                                       final TokenInfoService tokenInfoService); FundRepositoryContract fundRepository(); ClaimRepositoryContract claimRepository(); @PostConstruct void init(); @Cacheable(value = "possible_tokens", keyGenerator = "getAllPossibleTokensKeyGenerator") List<TokenInfoDto> getAllPossibleTokens(final String platform, final String platformId); }
FundRequestContractsService { @Cacheable(value = "possible_tokens", keyGenerator = "getAllPossibleTokensKeyGenerator") public List<TokenInfoDto> getAllPossibleTokens(final String platform, final String platformId) { return checkNotEmpty(getAllPossibleTokens().stream() .filter(token -> tokenWhitelistPreconditionContract.isValid(platform, platformId, token.getAddress())) .collect(Collectors.toList())); } FundRequestContractsService(final FundRequestContract fundRequestContract,
                                       final TokenWhitelistPreconditionContract tokenWhitelistPreconditionContract,
                                       final Web3j web3j,
                                       final TokenInfoService tokenInfoService); FundRepositoryContract fundRepository(); ClaimRepositoryContract claimRepository(); @PostConstruct void init(); @Cacheable(value = "possible_tokens", keyGenerator = "getAllPossibleTokensKeyGenerator") List<TokenInfoDto> getAllPossibleTokens(final String platform, final String platformId);  }