### Question:
EcoNewsServiceImpl implements EcoNewsService { @Override public List<EcoNewsDto> getThreeRecommendedEcoNews(Long openedEcoNewsId) { List<EcoNews> ecoNewsList = ecoNewsRepo.getThreeRecommendedEcoNews(openedEcoNewsId); return ecoNewsList .stream() .map(ecoNews -> modelMapper.map(ecoNews, EcoNewsDto.class)) .collect(Collectors.toList()); }  @CacheEvict(value = CacheConstants.NEWEST_ECO_NEWS_CACHE_NAME, allEntries = true) @Override AddEcoNewsDtoResponse save(AddEcoNewsDtoRequest addEcoNewsDtoRequest,
                                      MultipartFile image, String email); @Cacheable(value = CacheConstants.NEWEST_ECO_NEWS_CACHE_NAME) @Override List<EcoNewsDto> getThreeLastEcoNews(); @Override List<EcoNewsDto> getThreeRecommendedEcoNews(Long openedEcoNewsId); @Override PageableDto<EcoNewsDto> findAll(Pageable page); @Override PageableDto<EcoNewsDto> find(Pageable page, List<String> tags); @Override EcoNews findById(Long id); @Override EcoNewsDto findDtoById(Long id); @CacheEvict(value = CacheConstants.NEWEST_ECO_NEWS_CACHE_NAME, allEntries = true) @Override void delete(Long id); @Override PageableDto<SearchNewsDto> search(String searchQuery); @Override Long getAmountOfPublishedNewsByUserId(Long id);  }### Answer:
@Test void getThreeRecommendedEcoNews() { List<EcoNewsDto> dtoList = Collections.singletonList(modelMapper.map(ecoNews, EcoNewsDto.class)); when(ecoNewsRepo.findById(1L)).thenReturn(Optional.ofNullable(ecoNews)); when(ecoNewsRepo.getThreeRecommendedEcoNews(1L)).thenReturn(Collections.singletonList(ecoNews)); when(ecoNewsRepo.getThreeLastEcoNews()).thenReturn(Collections.singletonList(ecoNews)); when(modelMapper.map(ecoNews, EcoNewsDto.class)).thenReturn(dtoList.get(0)); List<EcoNewsDto> actual = ecoNewsService.getThreeRecommendedEcoNews(1L); assertEquals(dtoList, actual); }