コード例 #1
0
  @Test
  public void testCheckWithNullWord() {
    SpellCheckerInvalidParameterException exception = null;
    try {
      spellCheckerService.check(KNOWN_LANGUAGE, null);

    } catch (SpellCheckerInvalidParameterException e) {
      exception = e;
    }
    Assert.assertNotNull(exception);
    Assert.assertEquals(
        SpellCheckerExceptionStatus.INVALID_WORD.toString(), exception.getMessage());
  }
コード例 #2
0
  @Test
  public void testAddWordWithNullName() {
    SpellCheckerInvalidParameterException exception = null;
    LanguageRepository languageRepositoryMock = Mockito.mock(LanguageRepository.class);
    Mockito.when(languageRepositoryMock.findByShortCode(KNOWN_LANGUAGE)).thenReturn(enLanguage);

    spellCheckerService.setLanguageRepository(languageRepositoryMock);

    try {
      spellCheckerService.addWord(KNOWN_LANGUAGE, null);
    } catch (SpellCheckerInvalidParameterException e) {
      exception = e;
    }
    Assert.assertNotNull(exception);
    Assert.assertEquals(
        SpellCheckerExceptionStatus.INVALID_WORD.toString(), exception.getMessage());
  }