47 lines
1.4 KiB
Java
47 lines
1.4 KiB
Java
package hhn.temp.project;
|
|
|
|
import hhn.temp.project.provider.DatabaseManager;
|
|
import hhn.temp.project.provider.SimpleDatabaseManager;
|
|
import jdk.jshell.spi.ExecutionControl;
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
import org.junit.jupiter.api.DisplayName;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import java.io.IOException;
|
|
import java.sql.SQLException;
|
|
|
|
public class DatabaseGoodCasesTest {
|
|
|
|
private DatabaseManager<Task> databaseManager;
|
|
private AssignmentManager manager;
|
|
|
|
@BeforeEach
|
|
public void setup() {
|
|
databaseManager = new SimpleDatabaseManager<>();
|
|
manager = new AssignmentManager();
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("Assert that the TestClass could be inserted into the database")
|
|
public void assertGetTestClass() throws SQLException, IOException, ExecutionControl.NotImplementedException {
|
|
|
|
databaseManager.connect();
|
|
Task task = databaseManager.getObject(1);
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("Assert that a simple Task could be inserted into the database")
|
|
public void assertInsertTestClass() throws SQLException, IOException, ExecutionControl.NotImplementedException {
|
|
|
|
Task testTask = new Task(1, 1, "Hello World", "Description");
|
|
|
|
databaseManager.connect();
|
|
databaseManager.saveObject(testTask);
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("Assert connecting to database")
|
|
public void assertConnectToDatabase() throws SQLException, IOException {
|
|
databaseManager.connect();
|
|
}
|
|
} |