Fix the logic on determining whether connection is closed

This commit is contained in:
김선우
2025-01-27 19:49:10 +09:00
parent 1125e51a59
commit 6252947232
3 changed files with 4 additions and 3 deletions

View File

@@ -31,7 +31,6 @@ public abstract class LimboConnection implements Connection {
public LimboConnection(String url, String filePath, Properties properties) throws SQLException {
this.database = open(url, filePath, properties);
this.connectionPtr = this.database.connect();
this.closed = true;
}
private static AbstractDB open(String url, String filePath, Properties properties)

View File

@@ -88,8 +88,7 @@ public class JDBC4Connection extends LimboConnection {
@Override
public boolean isClosed() throws SQLException {
// TODO
return false;
return super.isClosed();
}
@Override

View File

@@ -68,13 +68,16 @@ class JDBC4ConnectionTest {
@Test
void calling_close_multiple_times_throws_no_exception() throws Exception {
assertFalse(connection.isClosed());
connection.close();
assertTrue(connection.isClosed());
connection.close();
}
@Test
void calling_methods_on_closed_connection_should_throw_exception() throws Exception {
connection.close();
assertTrue(connection.isClosed());
assertThrows(
SQLException.class,
() ->