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

See gh-25620
This commit is contained in:
Andy Wilkinson 2021-03-16 16:20:11 +00:00
parent 42841b895f
commit a832cc9ccd
2 changed files with 5 additions and 5 deletions

View File

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

View File

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