@Test public void add_ups_all_misconfiguration_errors() { thrown.expect(RuntimeException.class); thrown.expectMessage(" - 'masterChangelog' should not be null"); thrown.expectMessage(" - Exactly one of JDBC URI or DataSource need to be configured"); new ConfigurationBuilder().build(); }
public Configuration build() { Collection<String> errors = new ArrayList<>(); errors.addAll(mandatoryOptionValidator.validate(changelogLoader, masterChangelog)); errors.addAll(datasourceConnectionValidator.validate(uri, dataSource, database)); errors.addAll(executionModeValidator.validate(executionMode)); errors.addAll(userCredentialsOptionValidator.validate(username.orElse(null), password.orElse(null))); if (!errors.isEmpty()) { throw new RuntimeException(formatErrors(errors)); } return new Configuration( changelogLoader, masterChangelog, dataSourceConfiguration(), executionContexts, executionMode, database.orElse(null) ); }
ConfigurationBuilder { public Configuration build() { Collection<String> errors = new ArrayList<>(); errors.addAll(mandatoryOptionValidator.validate(changelogLoader, masterChangelog)); errors.addAll(datasourceConnectionValidator.validate(uri, dataSource, database)); errors.addAll(executionModeValidator.validate(executionMode)); errors.addAll(userCredentialsOptionValidator.validate(username.orElse(null), password.orElse(null))); if (!errors.isEmpty()) { throw new RuntimeException(formatErrors(errors)); } return new Configuration( changelogLoader, masterChangelog, dataSourceConfiguration(), executionContexts, executionMode, database.orElse(null) ); } }
ConfigurationBuilder { public Configuration build() { Collection<String> errors = new ArrayList<>(); errors.addAll(mandatoryOptionValidator.validate(changelogLoader, masterChangelog)); errors.addAll(datasourceConnectionValidator.validate(uri, dataSource, database)); errors.addAll(executionModeValidator.validate(executionMode)); errors.addAll(userCredentialsOptionValidator.validate(username.orElse(null), password.orElse(null))); if (!errors.isEmpty()) { throw new RuntimeException(formatErrors(errors)); } return new Configuration( changelogLoader, masterChangelog, dataSourceConfiguration(), executionContexts, executionMode, database.orElse(null) ); }  }
ConfigurationBuilder { public Configuration build() { Collection<String> errors = new ArrayList<>(); errors.addAll(mandatoryOptionValidator.validate(changelogLoader, masterChangelog)); errors.addAll(datasourceConnectionValidator.validate(uri, dataSource, database)); errors.addAll(executionModeValidator.validate(executionMode)); errors.addAll(userCredentialsOptionValidator.validate(username.orElse(null), password.orElse(null))); if (!errors.isEmpty()) { throw new RuntimeException(formatErrors(errors)); } return new Configuration( changelogLoader, masterChangelog, dataSourceConfiguration(), executionContexts, executionMode, database.orElse(null) ); }  ConfigurationBuilder withMasterChangelogLocation(String masterChangelog); ConfigurationBuilder withUri(String uri); ConfigurationBuilder withDataSource(DataSource dataSource); ConfigurationBuilder withDatabase(String database); ConfigurationBuilder withUsername(String username); ConfigurationBuilder withPassword(String password); ConfigurationBuilder withExecutionContexts(String... executionContexts); ConfigurationBuilder withExecutionContexts(Collection<String> executionContexts); ConfigurationBuilder withRunMode(); ConfigurationBuilder withDryRunMode(Path outputDirectory); @Deprecated ConfigurationBuilder withClassLoader(ClassLoader classLoader); ConfigurationBuilder withChangelogLoader(ChangelogLoader changelogLoader); Configuration build(); }
ConfigurationBuilder { public Configuration build() { Collection<String> errors = new ArrayList<>(); errors.addAll(mandatoryOptionValidator.validate(changelogLoader, masterChangelog)); errors.addAll(datasourceConnectionValidator.validate(uri, dataSource, database)); errors.addAll(executionModeValidator.validate(executionMode)); errors.addAll(userCredentialsOptionValidator.validate(username.orElse(null), password.orElse(null))); if (!errors.isEmpty()) { throw new RuntimeException(formatErrors(errors)); } return new Configuration( changelogLoader, masterChangelog, dataSourceConfiguration(), executionContexts, executionMode, database.orElse(null) ); }  ConfigurationBuilder withMasterChangelogLocation(String masterChangelog); ConfigurationBuilder withUri(String uri); ConfigurationBuilder withDataSource(DataSource dataSource); ConfigurationBuilder withDatabase(String database); ConfigurationBuilder withUsername(String username); ConfigurationBuilder withPassword(String password); ConfigurationBuilder withExecutionContexts(String... executionContexts); ConfigurationBuilder withExecutionContexts(Collection<String> executionContexts); ConfigurationBuilder withRunMode(); ConfigurationBuilder withDryRunMode(Path outputDirectory); @Deprecated ConfigurationBuilder withClassLoader(ClassLoader classLoader); ConfigurationBuilder withChangelogLoader(ChangelogLoader changelogLoader); Configuration build();  }