mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
Add test for close()
This commit is contained in:
parent
dae15ef0e3
commit
1125e51a59
2 changed files with 17 additions and 0 deletions
|
@ -49,6 +49,7 @@ public abstract class LimboConnection implements Connection {
|
|||
return;
|
||||
}
|
||||
this._close(this.connectionPtr);
|
||||
this.closed = true;
|
||||
}
|
||||
|
||||
private native void _close(long connectionPtr);
|
||||
|
|
|
@ -65,4 +65,20 @@ class JDBC4ConnectionTest {
|
|||
void prepare_simple_create_table() throws Exception {
|
||||
connection.prepare("CREATE TABLE users (id INT PRIMARY KEY, username TEXT)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void calling_close_multiple_times_throws_no_exception() throws Exception {
|
||||
connection.close();
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void calling_methods_on_closed_connection_should_throw_exception() throws Exception {
|
||||
connection.close();
|
||||
assertThrows(
|
||||
SQLException.class,
|
||||
() ->
|
||||
connection.createStatement(
|
||||
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, -1));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue