### Question:
ScriptRunner { public void runScript(Reader reader) throws IOException, SQLException { try { boolean originalAutoCommit = connection.getAutoCommit(); try { if (originalAutoCommit != this.autoCommit) { connection.setAutoCommit(this.autoCommit); } runScript(connection, reader); } finally { connection.setAutoCommit(originalAutoCommit); } } catch (IOException | SQLException e) { throw e; } catch (Exception e) { throw new RuntimeException("Error running script. Cause: " + e, e); } } ScriptRunner(Connection connection, boolean autoCommit, boolean stopOnError); void setDelimiter(String delimiter, boolean fullLineDelimiter); void runScript(Reader reader); void runScript(Reader reader, String dbName); static final Logger logger; }### Answer:
@Test public void testRunScript() { Exception exception = null; ScriptRunner s = new ScriptRunner(null, true, true); try { s.runScript(new StringReader("select 1")); } catch (Exception e) { exception = e; } Assert.assertNotNull(exception); runScript(""); }
@Test public void testRunScriptWithDbName() { runScript("db_test"); }