@Test
public void testApplyCustomScriptFeatureExecutionHandlesSQLExceptionsProperly() throws DbFeatureException, SQLException {

    // GIVEN
    when(ps.execute()).thenThrow(new SQLException("error"));
    // WHEN
    final DbFeature<Connection> feature = featureExecutor.createApplyCustomScriptFeature(Arrays.asList("test.script"));
    assertThat(feature, notNullValue());
    try {
        feature.execute(connection);
        fail("exception expected");
    } catch (final DbFeatureException e) {
        // expected
    }
    // THEN
    verify(connection).prepareStatement(any(String.class));
    verify(ps).execute();
    verify(ps).close();
}