|
|
@ -44,6 +44,16 @@ public abstract class AbstractScriptDatabaseInitializerTests<T extends AbstractS
|
|
|
|
assertThat(numberOfEmbeddedRows("SELECT COUNT(*) FROM EXAMPLE")).isOne();
|
|
|
|
assertThat(numberOfEmbeddedRows("SELECT COUNT(*) FROM EXAMPLE")).isOne();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void whenDatabaseIsInitializedWithDirectoryLocationsThenFailureIsHelpful() {
|
|
|
|
|
|
|
|
DatabaseInitializationSettings settings = new DatabaseInitializationSettings();
|
|
|
|
|
|
|
|
settings.setSchemaLocations(Arrays.asList("/org/springframework/boot/sql/init"));
|
|
|
|
|
|
|
|
settings.setDataLocations(Arrays.asList("/org/springframework/boot/sql/init"));
|
|
|
|
|
|
|
|
T initializer = createEmbeddedDatabaseInitializer(settings);
|
|
|
|
|
|
|
|
assertThatIllegalStateException().isThrownBy(initializer::initializeDatabase)
|
|
|
|
|
|
|
|
.withMessage("No schema scripts found at location '/org/springframework/boot/sql/init'");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void whenContinueOnErrorIsFalseThenInitializationFailsOnError() {
|
|
|
|
void whenContinueOnErrorIsFalseThenInitializationFailsOnError() {
|
|
|
|
DatabaseInitializationSettings settings = new DatabaseInitializationSettings();
|
|
|
|
DatabaseInitializationSettings settings = new DatabaseInitializationSettings();
|
|
|
|