### Question:
SQLEnvironmentsNotifierFactory extends AbstractNotifierFactory implements NotifierFactory { @Override public void validate(Map<String, Object> configuration) throws InvalidConfigurationException { String environmentFilename = getRequiredString(configuration, ENVIRONMENT_CONFIG_FILE); String databaseFilename = getRequiredString(configuration, DATABASES_CONFIG_FILE); String databaseEnvironment = getRequiredString(configuration, DATABASE_ENVIRONMENT); getRequiredString(configuration, DRIVER); getRequiredString(configuration, TARGET_VERSION_NOTIFICATIONS_TABLE); initYamlConfigurators(environmentFilename, databaseFilename, databaseEnvironment); }  @Override void validate(Map<String, Object> configuration); @Override SQLNotifier createNotifier(Map<String, Object> configuration, String name, String webUiUrl);  }### Answer:
@Test public void testValidateSuccess() throws IOException { writeTo(environmentFile, environmentConfig); writeTo(databaseFile, workingDatabaseConfig); try { factory.validate(workingConfiguration); } catch (InvalidConfigurationException e) { assertTrue("This configuration is valid " + e.getMessage(), false); } }
@Test public void testValidateFailDatabaseConfigMissingField() throws IOException { writeTo(environmentFile, environmentConfig); writeTo(databaseFile, databaseConfigMissingField); try { factory.validate(workingConfiguration); assertTrue("This configuration is invalid", false); } catch (InvalidConfigurationException e) { assertTrue("This configuration is invalid " + e.getMessage(), true); } }
@Test public void testValidateFailWrongDatabaseConfigName() throws IOException { writeTo(environmentFile, environmentConfig); writeTo(databaseFile, databaseConfigWrongConfigName); try { factory.validate(workingConfiguration); assertTrue("This configuration is invalid", false); } catch (InvalidConfigurationException e) { assertTrue("This configuration is invalid " + e.getMessage(), true); } }
@Test public void testValidateFailMissingConfigFile() throws IOException { writeTo(environmentFile, environmentConfig); writeTo(databaseFile, workingDatabaseConfig); try { factory.validate(configurationMissingFile); assertTrue("This configuration is invalid", false); } catch (Exception e) { assertTrue("This configuration is invalid " + e.getMessage(), e.getCause() instanceof FileNotFoundException); } }
@Test public void testValidateFailWrongDatabaseEnvirnment() throws IOException { writeTo(environmentFile, invalidEnvironmentConfig); writeTo(databaseFile, workingDatabaseConfig); try { factory.validate(workingConfiguration); assertTrue("This configuration is invalid", false); } catch (Exception e) { assertTrue("This configuration is invalid " + e.getMessage(), true); } }