@Test void findDtoByIdTest() { TipsAndTricksDtoResponse tipsAndTricksDtoResponse = ModelUtils.getTipsAndTricksDtoResponse(); when(tipsAndTricksRepo.findById(1L)).thenReturn(Optional.of(tipsAndTricks)); when(modelMapper.map(tipsAndTricks, TipsAndTricksDtoResponse.class)).thenReturn(tipsAndTricksDtoResponse); TipsAndTricksDtoResponse actual = tipsAndTricksService.findDtoById(1L); assertEquals(tipsAndTricksDtoResponse, actual); }
@Override public TipsAndTricksDtoResponse findDtoById(Long id) { TipsAndTricks tipsAndTricks = findById(id); return modelMapper.map(tipsAndTricks, TipsAndTricksDtoResponse.class); }
TipsAndTricksServiceImpl implements TipsAndTricksService { @Override public TipsAndTricksDtoResponse findDtoById(Long id) { TipsAndTricks tipsAndTricks = findById(id); return modelMapper.map(tipsAndTricks, TipsAndTricksDtoResponse.class); } }
TipsAndTricksServiceImpl implements TipsAndTricksService { @Override public TipsAndTricksDtoResponse findDtoById(Long id) { TipsAndTricks tipsAndTricks = findById(id); return modelMapper.map(tipsAndTricks, TipsAndTricksDtoResponse.class); }  }
TipsAndTricksServiceImpl implements TipsAndTricksService { @Override public TipsAndTricksDtoResponse findDtoById(Long id) { TipsAndTricks tipsAndTricks = findById(id); return modelMapper.map(tipsAndTricks, TipsAndTricksDtoResponse.class); }  @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override TipsAndTricksDtoResponse save(TipsAndTricksDtoRequest tipsAndTricksDtoRequest, MultipartFile image,
                                         String email); @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override void update(TipsAndTricksDtoManagement tipsAndTricksDtoManagement,
                       MultipartFile image); @Cacheable(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME) @Override PageableDto<TipsAndTricksDtoResponse> findAll(Pageable page); @Override PageableDto<TipsAndTricksDtoResponse> find(Pageable page, List<String> tags); @Override TipsAndTricksDtoResponse findDtoById(Long id); @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override void delete(Long id); @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override void deleteAll(List<Long> listId); TipsAndTricks findById(Long id); @Override TipsAndTricksDtoManagement findManagementDtoById(Long id); @Override PageableDto<SearchTipsAndTricksDto> search(String searchQuery); @Override Long getAmountOfWrittenTipsAndTrickByUserId(Long id); }
TipsAndTricksServiceImpl implements TipsAndTricksService { @Override public TipsAndTricksDtoResponse findDtoById(Long id) { TipsAndTricks tipsAndTricks = findById(id); return modelMapper.map(tipsAndTricks, TipsAndTricksDtoResponse.class); }  @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override TipsAndTricksDtoResponse save(TipsAndTricksDtoRequest tipsAndTricksDtoRequest, MultipartFile image,
                                         String email); @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override void update(TipsAndTricksDtoManagement tipsAndTricksDtoManagement,
                       MultipartFile image); @Cacheable(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME) @Override PageableDto<TipsAndTricksDtoResponse> findAll(Pageable page); @Override PageableDto<TipsAndTricksDtoResponse> find(Pageable page, List<String> tags); @Override TipsAndTricksDtoResponse findDtoById(Long id); @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override void delete(Long id); @CacheEvict(value = CacheConstants.TIPS_AND_TRICKS_CACHE_NAME, allEntries = true) @Override void deleteAll(List<Long> listId); TipsAndTricks findById(Long id); @Override TipsAndTricksDtoManagement findManagementDtoById(Long id); @Override PageableDto<SearchTipsAndTricksDto> search(String searchQuery); @Override Long getAmountOfWrittenTipsAndTrickByUserId(Long id);  }