@Test public void findByIdTest() { CustomGoal customGoal = new CustomGoal(1L, "foo", null, null); when(customGoalRepo.findById(anyLong())).thenReturn(java.util.Optional.of(customGoal)); when(modelMapper.map(customGoal, CustomGoalResponseDto.class)) .thenReturn(new CustomGoalResponseDto(customGoal.getId(), customGoal.getText())); CustomGoalResponseDto findByIdResult = customGoalService.findById(1L); assertEquals("foo", findByIdResult.getText()); assertEquals(1L, (long) findByIdResult.getId()); }
@Transactional @Override public CustomGoalResponseDto findById(Long id) { return modelMapper.map(findOne(id), CustomGoalResponseDto.class); }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public CustomGoalResponseDto findById(Long id) { return modelMapper.map(findOne(id), CustomGoalResponseDto.class); } }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public CustomGoalResponseDto findById(Long id) { return modelMapper.map(findOne(id), CustomGoalResponseDto.class); }  }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public CustomGoalResponseDto findById(Long id) { return modelMapper.map(findOne(id), CustomGoalResponseDto.class); }  @Transactional @Override List<CustomGoalResponseDto> save(BulkSaveCustomGoalDto bulkSave, User user); @Transactional @Override List<CustomGoalResponseDto> findAll(); @Transactional @Override CustomGoalResponseDto findById(Long id); @Transactional @Override List<CustomGoalResponseDto> updateBulk(BulkCustomGoalDto bulkCustomGoalDto); @Transactional @Override List<CustomGoalResponseDto> findAllByUser(Long userId); @Transactional @Override List<Long> bulkDelete(String ids); }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public CustomGoalResponseDto findById(Long id) { return modelMapper.map(findOne(id), CustomGoalResponseDto.class); }  @Transactional @Override List<CustomGoalResponseDto> save(BulkSaveCustomGoalDto bulkSave, User user); @Transactional @Override List<CustomGoalResponseDto> findAll(); @Transactional @Override CustomGoalResponseDto findById(Long id); @Transactional @Override List<CustomGoalResponseDto> updateBulk(BulkCustomGoalDto bulkCustomGoalDto); @Transactional @Override List<CustomGoalResponseDto> findAllByUser(Long userId); @Transactional @Override List<Long> bulkDelete(String ids);  }