### Question:
FactTranslationServiceImpl implements FactTranslationService { @Override public List<FactTranslation> saveHabitFactAndFactTranslation(HabitFactPostDTO habitFactPostDTO) { HabitFact habitFact = habitFactService.save(habitFactPostDTO); List<FactTranslation> factTranslations = modelMapper.map(habitFactPostDTO.getTranslations(), new TypeToken<List<FactTranslation>>() { }.getType()); factTranslations = factTranslations .stream() .peek(a -> a.setHabitFact(habitFact)) .collect(Collectors.toList()); return saveFactTranslation(factTranslations); } @Autowired  FactTranslationServiceImpl(FactTranslationRepo factTranslationRepo, HabitFactService habitFactService,
                                      ModelMapper modelMapper); @Override List<FactTranslation> saveHabitFactAndFactTranslation(HabitFactPostDTO habitFactPostDTO); @Override List<FactTranslation> saveFactTranslation(List<FactTranslation> factTranslations); @Cacheable(value = HABIT_FACT_OF_DAY_CACHE) @Override LanguageTranslationDTO getFactOfTheDay(Long languageId);  }### Answer:
@Test void saveHabitFactAndFactTranslation() { HabitFact habitFact = getHabitFact(); HabitFactPostDTO habitFactPostDTO = getHabitFactPostDTO(); List<FactTranslation> factTranslations = Collections.singletonList(getFactTranslation()); when(habitFactService.save(habitFactPostDTO)).thenReturn(habitFact); when(modelMapper.map(habitFactPostDTO.getTranslations(), new TypeToken<List<FactTranslation>>() { }.getType())).thenReturn(factTranslations); when(factTranslationRepo.saveAll(factTranslations)).thenReturn(factTranslations); factTranslationService.saveHabitFactAndFactTranslation(habitFactPostDTO); verify(factTranslationRepo, times(1)).saveAll(factTranslations); assertEquals(factTranslations.get(0).getHabitFact(), habitFact); }