First database tests
This commit is contained in:
37
test/hhn/temp/project/BadCasesTest.java
Normal file
37
test/hhn/temp/project/BadCasesTest.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import hhn.temp.project.AssignmentManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class BadCasesTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
AssignmentManager manager = new AssignmentManager();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that added tasks can't be Null")
|
||||
public void assertNewTasksAreNotNull() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert List isn't empty after adding a task")
|
||||
public void assertListNowEmptyAfterAdd() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert only existing tasks can be edited")
|
||||
public void assertEditOnlyExistingTasks() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert Worker can only edit own tasks")
|
||||
public void assertWorkerMayOnlyEditOwnTasks() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
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<>();
|
||||
}
|
||||
}
|
||||
51
test/hhn/temp/project/GoodCasesTest.java
Normal file
51
test/hhn/temp/project/GoodCasesTest.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import hhn.temp.project.AssignmentManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class GoodCasesTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
AssignmentManager manager = new AssignmentManager();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that a Worker can add a Task")
|
||||
public void assertWorkerCanAddTask() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that added Tasks are added to the List")
|
||||
public void assertTasksShowInList() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert existing Tasks can be edited")
|
||||
public void assertExistingTasksCanBeEdited() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that Worker can remove own Task")
|
||||
public void assertWorkerCanRemoveOwnTask() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that Admin can remove every Task")
|
||||
public void assertAdminCanRemoveEveryTask() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert deleted Tasks no longer show up in the List")
|
||||
public void assertDeletedTasksDisappear() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user