summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelix Kehrer <felix.kehrer@gmail.com>2018-05-07 18:06:00 +0200
committerFelix Kehrer <felix.kehrer@gmail.com>2018-05-07 18:06:00 +0200
commit834f9b4fff11c778dbb09dc74a88d658fc094a54 (patch)
tree7268754eeb7053c52ce2490984c75592d1d96046 /src
parentdab91fac74c2c51ad823dc53b68acf5aea5b3111 (diff)
downloadsepm-groupproject-834f9b4fff11c778dbb09dc74a88d658fc094a54.tar.gz
sepm-groupproject-834f9b4fff11c778dbb09dc74a88d658fc094a54.tar.xz
sepm-groupproject-834f9b4fff11c778dbb09dc74a88d658fc094a54.zip
Changed test behaviour to leave "clean" database for other tests
Diffstat (limited to 'src')
-rw-r--r--src/main/resources/sql/H2RegistrationDAOTest_populate.sql5
-rw-r--r--src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDatabaseDAOTest.java24
2 files changed, 20 insertions, 9 deletions
diff --git a/src/main/resources/sql/H2RegistrationDAOTest_populate.sql b/src/main/resources/sql/H2RegistrationDAOTest_populate.sql
index 3c268a0..7e7b428 100644
--- a/src/main/resources/sql/H2RegistrationDAOTest_populate.sql
+++ b/src/main/resources/sql/H2RegistrationDAOTest_populate.sql
@@ -1,3 +1,8 @@
+DELETE FROM Registration;
+DELETE FROM Vehicle;
+DELETE FROM VehicleVersion;
+DELETE FROM Employee;
+DELETE FROM EmployeeVersion;
INSERT INTO EmployeeVersion (id, name, birthday, educationLevel, isDriver, isPilot) VALUES (1, 'John Doe', '2000-01-01', 'RS', TRUE, TRUE);
INSERT INTO EmployeeVersion (id, name, birthday, educationLevel, isDriver, isPilot) VALUES (2, 'Nick "Kage" Verily', '1990-01-01', 'NKV', TRUE, FALSE);
INSERT INTO EmployeeVersion (id, name, birthday, educationLevel, isDriver, isPilot) VALUES (3, 'Nicht Arzt', '1980-01-01', 'NA', FALSE, FALSE);
diff --git a/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDatabaseDAOTest.java b/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDatabaseDAOTest.java
index 980c429..03059ff 100644
--- a/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDatabaseDAOTest.java
+++ b/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDatabaseDAOTest.java
@@ -14,8 +14,7 @@ import java.time.LocalDate;
import java.util.LinkedList;
import java.util.List;
import org.h2.tools.RunScript;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
@@ -45,10 +44,6 @@ public class RegistrationDatabaseDAOTest {
"classpath:sql/database.sql",
Charset.forName("UTF8"),
false);
- }
-
- @Before
- public void setUp() throws SQLException {
RunScript.execute(
JDBC_URL,
USER,
@@ -57,9 +52,20 @@ public class RegistrationDatabaseDAOTest {
Charset.forName("UTF8"),
false);
}
-
- @After
- public void tearDown() throws SQLException {
+ /*
+ @Before
+ public void setUp() throws SQLException {
+ RunScript.execute(
+ JDBC_URL,
+ USER,
+ PASSWORD,
+ "classpath:sql/H2RegistrationDAOTest_populate.sql",
+ Charset.forName("UTF8"),
+ false);
+ }
+ */
+ @AfterClass
+ public static void tearDown() throws SQLException {
RunScript.execute(
JDBC_URL,
USER,