@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()); }
@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()); }