@Test public void findAllByIterable() { List<Fund> funds = singletonList(FundMother.fndFundFunderKnown().build()); Set<Long> ids = funds.stream().map(Fund::getId).collect(Collectors.toSet()); when(fundRepository.findAll(ids)).thenReturn(funds); List<FundDto> expecedFunds = singletonList(FundDtoMother.aFundDto().build()); when(mappers.mapList(Fund.class, FundDto.class, funds)).thenReturn(expecedFunds); List<FundDto> result = fundService.findAll(ids); assertThat(result).isEqualTo(expecedFunds); }
@Transactional(readOnly = true) @Override public List<FundDto> findAll() { return mappers.mapList(Fund.class, FundDto.class, fundRepository.findAll()); }
FundServiceImpl implements FundService { @Transactional(readOnly = true) @Override public List<FundDto> findAll() { return mappers.mapList(Fund.class, FundDto.class, fundRepository.findAll()); } }
FundServiceImpl implements FundService { @Transactional(readOnly = true) @Override public List<FundDto> findAll() { return mappers.mapList(Fund.class, FundDto.class, fundRepository.findAll()); } @Autowired  FundServiceImpl(final FundRepository fundRepository,
                           final RefundRepository refundRepository,
                           final PendingFundRepository pendingFundRepository,
                           final RequestRepository requestRepository,
                           final Mappers mappers,
                           final ApplicationEventPublisher eventPublisher,
                           final CacheManager cacheManager,
                           final FundRequestContractsService fundRequestContractsService,
                           final FiatService fiatService,
                           final TokenValueMapper tokenValueMapper,
                           final FundFundsByFunderAggregator fundFundsByFunderAggregator,
                           final RefundFundsByFunderAggregator refundFundsByFunderAggregator,
                           final FundsAndRefundsAggregator fundsAndRefundsAggregator); }
FundServiceImpl implements FundService { @Transactional(readOnly = true) @Override public List<FundDto> findAll() { return mappers.mapList(Fund.class, FundDto.class, fundRepository.findAll()); } @Autowired  FundServiceImpl(final FundRepository fundRepository,
                           final RefundRepository refundRepository,
                           final PendingFundRepository pendingFundRepository,
                           final RequestRepository requestRepository,
                           final Mappers mappers,
                           final ApplicationEventPublisher eventPublisher,
                           final CacheManager cacheManager,
                           final FundRequestContractsService fundRequestContractsService,
                           final FiatService fiatService,
                           final TokenValueMapper tokenValueMapper,
                           final FundFundsByFunderAggregator fundFundsByFunderAggregator,
                           final RefundFundsByFunderAggregator refundFundsByFunderAggregator,
                           final FundsAndRefundsAggregator fundsAndRefundsAggregator); @Transactional(readOnly = true) @Override List<FundDto> findAll(); @Transactional(readOnly = true) @Override List<FundDto> findAll(Iterable<Long> ids); @Override @Transactional(readOnly = true) FundDto findOne(Long id); @Override @Transactional(readOnly = true) @Cacheable(value = "funds", key = "#requestId", unless = "#result.isEmpty()") List<TokenValueDto> getTotalFundsForRequest(Long requestId); @Override @Transactional(readOnly = true) FundsForRequestDto getFundsForRequestGroupedByFunder(final Long requestId); @Override @CacheEvict(value = "funds", key = "#requestId") void clearTotalFundsCache(Long requestId); @Override @Transactional void addFunds(final FundsAddedCommand command); @Override Optional<TokenValueDto> getFundsFor(final Long requestId, final String funderAddress, final String tokenAddress); }
FundServiceImpl implements FundService { @Transactional(readOnly = true) @Override public List<FundDto> findAll() { return mappers.mapList(Fund.class, FundDto.class, fundRepository.findAll()); } @Autowired  FundServiceImpl(final FundRepository fundRepository,
                           final RefundRepository refundRepository,
                           final PendingFundRepository pendingFundRepository,
                           final RequestRepository requestRepository,
                           final Mappers mappers,
                           final ApplicationEventPublisher eventPublisher,
                           final CacheManager cacheManager,
                           final FundRequestContractsService fundRequestContractsService,
                           final FiatService fiatService,
                           final TokenValueMapper tokenValueMapper,
                           final FundFundsByFunderAggregator fundFundsByFunderAggregator,
                           final RefundFundsByFunderAggregator refundFundsByFunderAggregator,
                           final FundsAndRefundsAggregator fundsAndRefundsAggregator); @Transactional(readOnly = true) @Override List<FundDto> findAll(); @Transactional(readOnly = true) @Override List<FundDto> findAll(Iterable<Long> ids); @Override @Transactional(readOnly = true) FundDto findOne(Long id); @Override @Transactional(readOnly = true) @Cacheable(value = "funds", key = "#requestId", unless = "#result.isEmpty()") List<TokenValueDto> getTotalFundsForRequest(Long requestId); @Override @Transactional(readOnly = true) FundsForRequestDto getFundsForRequestGroupedByFunder(final Long requestId); @Override @CacheEvict(value = "funds", key = "#requestId") void clearTotalFundsCache(Long requestId); @Override @Transactional void addFunds(final FundsAddedCommand command); @Override Optional<TokenValueDto> getFundsFor(final Long requestId, final String funderAddress, final String tokenAddress);  }