-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestBase.java
More file actions
40 lines (33 loc) · 962 Bytes
/
TestBase.java
File metadata and controls
40 lines (33 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.ladybugdb;
import java.io.IOException;
import java.nio.file.Path;
import org.junit.jupiter.api.AfterAll;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.io.TempDir;
public class TestBase {
protected static Database db;
protected static Connection conn;
@TempDir
static Path tempDir;
@BeforeAll
static void getDBandConn() throws IOException {
String dbPath = tempDir.resolve("db.lbdb").toString();
TestHelper.loadData(dbPath);
db = TestHelper.getDatabase();
conn = TestHelper.getConnection();
}
@AfterAll
static void destroyDBandConn() {
try {
if (conn != null) {
conn.close();
}
if (db != null) {
db.close();
}
} catch (AssertionError e) {
fail("destroyDBandConn failed: ");
}
}
}