mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-04 08:54:20 +01:00
Merge branch 'main' into java-bindings-database-metadata
This commit is contained in:
@@ -2,6 +2,7 @@ package org.github.tursodatabase.core;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import org.github.tursodatabase.LimboErrorCode;
|
||||
@@ -13,16 +14,27 @@ public class LimboDBTest {
|
||||
|
||||
@Test
|
||||
void db_should_open_normally() throws Exception {
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
LimboDB.load();
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
LimboDB db = LimboDB.create("jdbc:sqlite" + dbPath, dbPath);
|
||||
db.open(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_throw_exception_when_opened_twice() throws Exception {
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
void db_should_close_normally() throws Exception {
|
||||
LimboDB.load();
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
LimboDB db = LimboDB.create("jdbc:sqlite" + dbPath, dbPath);
|
||||
db.open(0);
|
||||
db.close();
|
||||
|
||||
assertFalse(db.isOpen());
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_throw_exception_when_opened_twice() throws Exception {
|
||||
LimboDB.load();
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
LimboDB db = LimboDB.create("jdbc:sqlite:" + dbPath, dbPath);
|
||||
db.open(0);
|
||||
|
||||
@@ -31,8 +43,8 @@ public class LimboDBTest {
|
||||
|
||||
@Test
|
||||
void throwJavaException_should_throw_appropriate_java_exception() throws Exception {
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
LimboDB.load();
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
LimboDB db = LimboDB.create("jdbc:sqlite:" + dbPath, dbPath);
|
||||
|
||||
final int limboExceptionCode = LimboErrorCode.LIMBO_ETC.code;
|
||||
|
||||
@@ -84,4 +84,15 @@ class JDBC4ConnectionTest {
|
||||
connection.createStatement(
|
||||
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, -1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void isValid_should_return_true_on_open_connection() throws SQLException {
|
||||
assertTrue(connection.isValid(10));
|
||||
}
|
||||
|
||||
@Test
|
||||
void isValid_should_return_false_on_closed_connection() throws SQLException {
|
||||
connection.close();
|
||||
assertFalse(connection.isValid(10));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user