TranslationService { public void deleteTranslation(String sourcePhrase) { expanded.remove(getPositionOfTranslation(sourcePhrase)); for (Dictionary dictionary : dictionaryService.getDictionariesForCurrentDeck()) { Translation translation = dictionary.getTranslationBySourcePhrase(sourcePhrase); if (translation.getDbId() != -1) { translationRepository.deleteTranslation(translation.getDbId()); } } } TranslationService(TranslationRepository translationRepository, DictionaryService dictionaryService); void initializeCardStates(); List<Translation> getCurrentTranslations(); void deleteTranslation(String sourcePhrase); void expandCard(int position); void minimizeCard(int position); boolean cardIsExpanded(int position); void saveTranslationContext(NewTranslation context);  }
@Test public void deleteTranslation_shouldDeleteTranslationsBySourcePhraseFromCurrentDictionaries() { Dictionary dictionary = new Dictionary("", new Translation[]{defaultTranslation}, 0L); List<Dictionary> dictionaries = Collections.singletonList(dictionary); when(dictionaryService.getDictionariesForCurrentDeck()).thenReturn(dictionaries); translationService.deleteTranslation("label"); verify(translationRepository).deleteTranslation(1L); }