Polish "Improve error message when no resources exist at a script location"

See gh-25620
pull/25731/head
Andy Wilkinson 4 years ago
parent 42841b895f
commit a832cc9ccd

@ -161,7 +161,7 @@ class DataSourceInitializer {
} }
else if (validate) { else if (validate) {
throw new InvalidConfigurationPropertyValueException(propertyName, resource, throw new InvalidConfigurationPropertyValueException(propertyName, resource,
"Resource '" + location + "' does not exist."); "No resources were found at location '" + location + "'.");
} }
} }
} }

@ -223,8 +223,8 @@ class DataSourceInitializerInvokerTests {
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class); assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]"); assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.schema"); assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.schema");
assertThat(context.getStartupFailure()) assertThat(context.getStartupFailure()).hasMessageContaining(
.hasMessageContaining("Resource 'classpath:does/not/exist.sql' does not exist."); "No resources were found at location 'classpath:does/not/exist.sql'.");
}); });
} }
@ -237,8 +237,8 @@ class DataSourceInitializerInvokerTests {
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class); assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]"); assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.data"); assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.data");
assertThat(context.getStartupFailure()) assertThat(context.getStartupFailure()).hasMessageContaining(
.hasMessageContaining("Resource 'classpath:does/not/exist.sql' does not exist."); "No resources were found at location 'classpath:does/not/exist.sql'.");
}); });
} }

Loading…
Cancel
Save