@Test
  public void testAddWordUnknown() throws SpellCheckerInvalidParameterException {
    LanguageRepository languageRepositoryMock = Mockito.mock(LanguageRepository.class);
    Mockito.when(languageRepositoryMock.findByShortCode(KNOWN_LANGUAGE)).thenReturn(enLanguage);
    spellCheckerService.setLanguageRepository(languageRepositoryMock);

    WordRepository wordRepositoryMock = Mockito.mock(WordRepository.class);
    Mockito.when(wordRepositoryMock.findByLanguageAndName(enLanguage, UNKNOWN_WORD))
        .thenReturn(null);
    spellCheckerService.setWordRepository(wordRepositoryMock);

    Boolean isAdded = spellCheckerService.addWord(KNOWN_LANGUAGE, UNKNOWN_WORD);

    assertThat(isAdded).isEqualTo(true);
  }
  @Test
  public void testCheckWithUnknownWord() throws SpellCheckerInvalidParameterException {

    LanguageRepository languageRepositoryMock = Mockito.mock(LanguageRepository.class);
    Mockito.when(languageRepositoryMock.findByShortCode(KNOWN_LANGUAGE)).thenReturn(enLanguage);
    spellCheckerService.setLanguageRepository(languageRepositoryMock);

    WordRepository wordRepositoryMock = Mockito.mock(WordRepository.class);
    Mockito.when(wordRepositoryMock.findByLanguageAndName(enLanguage, UNKNOWN_WORD))
        .thenReturn(null);
    spellCheckerService.setWordRepository(wordRepositoryMock);

    Boolean wasFound = spellCheckerService.check(KNOWN_LANGUAGE, UNKNOWN_WORD);

    Assert.assertNotNull(wasFound);
    Assert.assertEquals(false, wasFound);
  }
  @Test
  public void testAddWordWithNewLanguage() {
    Language newLanguage = new Language(UNKNOWN_LANGUAGE);
    Word word = new Word(KNOWN_WORD, newLanguage);

    LanguageRepository languageRepositoryMock = Mockito.mock(LanguageRepository.class);
    Mockito.when(languageRepositoryMock.findByShortCode(UNKNOWN_LANGUAGE)).thenReturn(null);
    spellCheckerService.setLanguageRepository(languageRepositoryMock);

    WordRepository wordRepositoryMock = Mockito.mock(WordRepository.class);
    Mockito.when(wordRepositoryMock.findByLanguageAndName(newLanguage, KNOWN_WORD))
        .thenReturn(word);
    spellCheckerService.setWordRepository(wordRepositoryMock);

    Boolean isAdded = spellCheckerService.addWord(UNKNOWN_LANGUAGE, UNKNOWN_WORD);

    assertThat(isAdded).isNotNull();
    assertThat(isAdded).isEqualTo(true);

    verify(languageRepositoryMock, times(1)).save(Mockito.any(Language.class));
    verify(wordRepositoryMock, times(1)).save(Mockito.any(Word.class));
  }