@Test void findDtoById() { EcoNewsDto ecoNewsDto = modelMapper.map(ecoNews, EcoNewsDto.class); when(ecoNewsRepo.findById(1L)).thenReturn(Optional.of(ecoNews)); when(modelMapper.map(ecoNews, EcoNewsDto.class)).thenReturn(ecoNewsDto); EcoNewsDto actual = ecoNewsService.findDtoById(1L); assertEquals(ecoNewsDto, actual); }
@Override public EcoNewsDto findDtoById(Long id) { EcoNews ecoNews = findById(id); return modelMapper.map(ecoNews, EcoNewsDto.class); }
EcoNewsServiceImpl implements EcoNewsService { @Override public EcoNewsDto findDtoById(Long id) { EcoNews ecoNews = findById(id); return modelMapper.map(ecoNews, EcoNewsDto.class); } }
EcoNewsServiceImpl implements EcoNewsService { @Override public EcoNewsDto findDtoById(Long id) { EcoNews ecoNews = findById(id); return modelMapper.map(ecoNews, EcoNewsDto.class); }  }
EcoNewsServiceImpl implements EcoNewsService { @Override public EcoNewsDto findDtoById(Long id) { EcoNews ecoNews = findById(id); return modelMapper.map(ecoNews, EcoNewsDto.class); }  @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); }
EcoNewsServiceImpl implements EcoNewsService { @Override public EcoNewsDto findDtoById(Long id) { EcoNews ecoNews = findById(id); return modelMapper.map(ecoNews, EcoNewsDto.class); }  @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);  }