Search in sources :

Example 1 with BaseFlywayCallback

use of org.flywaydb.core.api.callback.BaseFlywayCallback in project flyway by flyway.

the class FlywayCallbackSmallTest method failingCallbackTest.

@Test(expected = IllegalStateException.class)
public void failingCallbackTest() {
    FlywayCallback failingCallback = new BaseFlywayCallback() {

        @Override
        public void beforeMigrate(Connection connection) {
            throw new IllegalStateException("Failing");
        }
    };
    final Flyway flyway = new Flyway();
    flyway.configure(createProperties("failing"));
    flyway.setCallbacks(failingCallback);
    assertNotNull(flyway.getDataSource());
    flyway.migrate();
}
Also used : FlywayCallback(org.flywaydb.core.api.callback.FlywayCallback) BaseFlywayCallback(org.flywaydb.core.api.callback.BaseFlywayCallback) BaseFlywayCallback(org.flywaydb.core.api.callback.BaseFlywayCallback) Connection(java.sql.Connection) Test(org.junit.Test)

Aggregations

Connection (java.sql.Connection)1 BaseFlywayCallback (org.flywaydb.core.api.callback.BaseFlywayCallback)1 FlywayCallback (org.flywaydb.core.api.callback.FlywayCallback)1 Test (org.junit.Test)1