use of liquibase.sdk.database.MockDatabase in project liquibase by liquibase.
the class LiquibaseTest method setCurrentDateTimeFunction.
@Test
public void setCurrentDateTimeFunction() throws LiquibaseException {
Database database = mockDatabase;
String testFunction = "GetMyTime";
new Liquibase("com/example/test.xml", mockResourceAccessor, database).setCurrentDateTimeFunction(testFunction);
verify(database).setCurrentDateTimeFunction(testFunction);
}
use of liquibase.sdk.database.MockDatabase in project liquibase by liquibase.
the class LiquibaseTest method constructor_createDatabaseInstanceFromConnection.
@Test
public void constructor_createDatabaseInstanceFromConnection() throws LiquibaseException {
DatabaseConnection databaseConnection = mock(DatabaseConnection.class);
Database database = mockDatabase;
try {
DatabaseFactory.setInstance(mock(DatabaseFactory.class));
when(DatabaseFactory.getInstance().findCorrectDatabaseImplementation(databaseConnection)).thenReturn(database);
Liquibase liquibase = new Liquibase("com/example/test.xml", mockResourceAccessor, databaseConnection);
assertSame("Liquibase constructor passing connection did not find the correct database implementation", database, liquibase.getDatabase());
} finally {
DatabaseFactory.reset();
}
}
Aggregations