### Question:
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);  }### Answer:
@Test void testNoDuplicates() throws Exception { String platform = "GITHUB"; String platformId = "FundRequest|FR|area51|FR|3"; when(tokenWhitelistPreconditionContract.amountOftokens().send().intValue()).thenReturn(3); when(tokenWhitelistPreconditionContract.token(BigInteger.valueOf(0))).thenReturn(Optional.of("FND")); when(tokenWhitelistPreconditionContract.token(BigInteger.valueOf(1))).thenReturn(Optional.of("ZRX")); when(tokenWhitelistPreconditionContract.token(BigInteger.valueOf(2))).thenReturn(Optional.of("ZRX")); when(tokenInfoService.getTokenInfo("FND")).thenReturn(TokenInfoDto.builder().symbol("FND").address("FND").build()); when(tokenInfoService.getTokenInfo("ZRX")).thenReturn(TokenInfoDto.builder().symbol("ZRX").address("ZRX").build()); when(tokenWhitelistPreconditionContract.isValid(platform, platformId, "FND")).thenReturn(true); when(tokenWhitelistPreconditionContract.isValid(platform, platformId, "ZRX")).thenReturn(true); List<TokenInfoDto> possibleTokens = fundRequestContractsService.getAllPossibleTokens(platform, platformId); assertThat(possibleTokens.stream().map(TokenInfoDto::getSymbol).collect(Collectors.toList())).containsExactly("FND", "ZRX"); }
@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(); } }