### Question:
AchievementServiceImpl implements AchievementService { @Cacheable(value = CacheConstants.ALL_ACHIEVEMENTS_CACHE_NAME) @Override public List<AchievementDTO> findAll() { return achievementRepo.findAll() .stream() .map(achieve -> modelMapper.map(achieve, AchievementDTO.class)) .collect(Collectors.toList()); }  @Cacheable(value = CacheConstants.ALL_ACHIEVEMENTS_CACHE_NAME) @Override List<AchievementDTO> findAll();  }### Answer:
@Test public void findAllWithEmptyListTest() { when(achievementRepo.findAll()).thenReturn(Collections.emptyList()); List<AchievementDTO> findAllResult = achievementService.findAll(); assertTrue(findAllResult.isEmpty()); }
@Test public void findAllWithOneValueInRepoTest() { Achievement achievement = new Achievement(1L, "foo", null, null, null); when(achievementRepo.findAll()) .thenReturn(Collections.singletonList(achievement)); when(modelMapper.map(achievement, AchievementDTO.class)) .thenReturn(new AchievementDTO(achievement.getId(), achievement.getTitle(), null, null)); List<AchievementDTO> findAllResult = achievementService.findAll(); assertEquals("foo", findAllResult.get(0).getTitle()); assertEquals(1L, (long) findAllResult.get(0).getId()); }