### Question:
KnowNERLanguageConfigurator { public List<String> run() throws KnowNERLanguageConfiguratorException { List<String> errorMessages = new ArrayList<>(); for (KnowNERResourceChecker checker : checkerList) { logger.info("Creating '" + language + "' KnowNER resources for " + checker.getClass().getSimpleName()); KnowNERResourceResult result = checker.check(); if (!result.isSuccess()) { errorMessages.add(result.getMessage()); } } return errorMessages; } KnowNERLanguageConfigurator(String language,
                   List<KnowNERResourceChecker> checkerList); List<String> run();  }### Answer:
@Test public void shouldHaveNoErrorMessagesWhenAllResourcesThere() throws KnowNERLanguageConfiguratorException { KnowNERResourceChecker mockedChecker = mock(KnowNERResourceChecker.class); when(mockedChecker.check()).thenReturn(new KnowNERResourceResult()); KnowNERLanguageConfigurator configurator = new KnowNERLanguageConfiguratorBuilder() .setLanguage("de") .setMainDir("") .addResourceChecker(mockedChecker) .create(); List<String> errorMessages = configurator.run(); assertEquals(0, errorMessages.size()); }
@Test public void shoulHavedOneErrorMessageWhenResourceIsMissing() throws KnowNERLanguageConfiguratorException { KnowNERResourceChecker mockedChecker = mock(KnowNERResourceChecker.class); when(mockedChecker.check()).thenReturn(new KnowNERResourceResult("Resource is missing")); KnowNERLanguageConfigurator configurator = new KnowNERLanguageConfiguratorBuilder() .setLanguage("de") .setMainDir("") .addResourceChecker(mockedChecker) .create(); List<String> errorMessages = configurator.run(); assertEquals(1, errorMessages.size()); }