### Question:
JdbcScriptRunner implements ScriptRunner { public void execute(Script script) { Database targetDatabase = getTargetDatabaseDatabase(script); if (targetDatabase == null) { logger.info("Script " + script.getFileName() + " has target database " + script.getTargetDatabaseName() + ". This database is disabled, so the script is not executed."); return; } try (Reader scriptContentReader = script.getScriptContentHandle().openScriptContentReader()) { ScriptParser scriptParser = databaseDialectScriptParserFactoryMap.get(targetDatabase.getSupportedDatabaseDialect()).createScriptParser(scriptContentReader); parseAndExecuteScript(targetDatabase, scriptParser); } catch (IOException e) { throw new DbMaintainException(e); } } JdbcScriptRunner(Map<String, ScriptParserFactory> databaseDialectScriptParserFactoryMap, Databases databases, SQLHandler sqlHandler); void execute(Script script); void initialize(); void close();  }### Answer:
@Test void execute() { defaultScriptRunner.execute(script1); defaultScriptRunner.execute(script2); assertTrue(isEmpty("table1", dataSource)); assertTrue(isEmpty("table2", dataSource)); assertTrue(isEmpty("table3", dataSource)); }
@Test void rollbackScriptWhenErrorOccurs() { defaultScriptRunner.execute(script1); assertThrows(DbMaintainException.class, () -> defaultScriptRunner.execute(insertsWithError)); assertTrue(isEmpty("table1", dataSource), "All inserts should have been rolled back"); }
@Test void commitScriptIfNoErrorOccurs() { defaultScriptRunner.execute(script1); defaultScriptRunner.execute(insertsWithoutError); assertEquals(3, getItemAsLong("select count(1) from table1", dataSource)); }
@Test void scriptThatContainsCommit() { defaultScriptRunner.execute(script1); defaultScriptRunner.execute(insertsWithCommit); assertEquals(3, getItemAsLong("select count(1) from table1", dataSource)); }
@Test void scriptThatContainsRollback() { defaultScriptRunner.execute(script1); defaultScriptRunner.execute(insertsWithRollback); assertEquals(1, getItemAsLong("select count(1) from table1", dataSource)); }
@Test void scriptThatContainsQuery() { defaultScriptRunner.execute(scriptWithQuery); }
@Test void emptyScript() { defaultScriptRunner.execute(emptyScript); }