### Question:
DefaultDatabaseConnectionGenerator implements DatabaseConnectionGenerator { @Override public void closeAllStatements() throws SQLException { for (Statement statement : this.statements) { if (statement.isClosed()) { continue; } statement.close(); } } protected  DefaultDatabaseConnectionGenerator();  DefaultDatabaseConnectionGenerator(String dbUrl, String userName, String password,
                                            DbSystem system);  DefaultDatabaseConnectionGenerator(ConfigurationSettingDatabaseConnection setting); @Override RelationalInput generateRelationalInputFromSql(String queryString, String relationName); @Override ResultSet generateResultSetFromSql(String queryString); @Override void closeAllStatements(); @Override @Transient @JsonIgnore Connection getConnection(); @Override void close(); @Transient @JsonIgnore boolean isClosed(); int getFetchSize(); DefaultDatabaseConnectionGenerator setFetchSize(int fetchSize); int getResultSetType(); DefaultDatabaseConnectionGenerator setResultSetType(int resultSetType); int getResultSetConcurrency(); DefaultDatabaseConnectionGenerator setResultSetConcurrency(int resultSetConcurrency); DbSystem getSystem(); void setSystem(DbSystem system); String getDbUrl(); void setDbUrl(String dbUrl); String getUserName(); void setUserName(String userName); String getPassword(); void setPassword(String password); @Transient @JsonIgnore boolean isConnected(); static final int DEFAULT_FETCH_SIZE; static final int DEFAULT_RESULT_SET_TYPE; static final int DEFAULT_RESULT_SET_CONCURRENCY; }### Answer:
@Test public void testCloseAllStatements() throws SQLException, InputGenerationException, AlgorithmConfigurationException { DefaultDatabaseConnectionGenerator defaultDatabaseConnectionGenerator = new DefaultDatabaseConnectionGenerator(); Connection connection = mock(Connection.class); defaultDatabaseConnectionGenerator.dbConnection = connection; Statement statementMock1 = mock(Statement.class); when(statementMock1.executeQuery(anyString())).thenReturn(mock(ResultSet.class)); Statement statementMock2 = mock(Statement.class); when(statementMock2.executeQuery(anyString())).thenReturn(mock(ResultSet.class)); Statement statementMock3 = mock(Statement.class); when(statementMock3.isClosed()).thenReturn(true); when(statementMock3.executeQuery(anyString())).thenReturn(mock(ResultSet.class)); when(connection.createStatement(anyInt(), anyInt())) .thenReturn(statementMock1, statementMock2, statementMock3); defaultDatabaseConnectionGenerator.executeQuery("some query 1"); defaultDatabaseConnectionGenerator.executeQuery("some query 2"); defaultDatabaseConnectionGenerator.executeQuery("some query 3"); defaultDatabaseConnectionGenerator.closeAllStatements(); verify(statementMock1).close(); verify(statementMock2).close(); verify(statementMock3, never()).close(); }