First database tests
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
package java;
|
||||
package hhn.temp.project;
|
||||
|
||||
import hhn.temp.project.AssignmentManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
39
test/hhn/temp/project/DatabaseBadCasesTest.java
Normal file
39
test/hhn/temp/project/DatabaseBadCasesTest.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import hhn.temp.project.provider.DatabaseManager;
|
||||
import hhn.temp.project.provider.SimpleDatabaseManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class DatabaseBadCasesTest {
|
||||
|
||||
private DatabaseManager<DatabaseGoodCasesTest.TestClass> databaseManager;
|
||||
|
||||
public class TestClass {
|
||||
private int id;
|
||||
private String dataString;
|
||||
private int dataInteger;
|
||||
|
||||
public TestClass(int id, String dataString, int dataInteger) {
|
||||
this.id = id;
|
||||
this.dataString = dataString;
|
||||
this.dataInteger = dataInteger;
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
databaseManager = new SimpleDatabaseManager<>();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert connection failed")
|
||||
public void assertConnectionFailed() {
|
||||
assertThrows(SQLException.class, () -> databaseManager.connect());
|
||||
}
|
||||
}
|
||||
25
test/hhn/temp/project/DatabaseGoodCasesTest.java
Normal file
25
test/hhn/temp/project/DatabaseGoodCasesTest.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import hhn.temp.project.provider.DatabaseManager;
|
||||
import hhn.temp.project.provider.SimpleDatabaseManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
public class DatabaseGoodCasesTest
|
||||
{
|
||||
public class TestClass {
|
||||
private int id;
|
||||
private String dataString;
|
||||
private int dataInteger;
|
||||
|
||||
public TestClass(int id, String dataString, int dataInteger) {
|
||||
this.id = id;
|
||||
this.dataString = dataString;
|
||||
this.dataInteger = dataInteger;
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
DatabaseManager<TestClass> databaseTaskManager = new SimpleDatabaseManager<>();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package java;
|
||||
package hhn.temp.project;
|
||||
|
||||
import hhn.temp.project.AssignmentManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -15,6 +14,7 @@ public class GoodCasesTest {
|
||||
public void setup() {
|
||||
AssignmentManager manager = new AssignmentManager();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that a Worker can add a Task")
|
||||
public void assertWorkerCanAddTask() {
|
||||
Reference in New Issue
Block a user