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.io.IOException; import java.sql.SQLException; import static org.junit.jupiter.api.Assertions.*; public class DatabaseBadCasesTest { private DatabaseManager 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() throws SQLException, IOException { databaseManager = new SimpleDatabaseManager<>(); databaseManager.connect(); databaseManager.clearDatabase(); } @Test @DisplayName("Gets an object that may not be existent") public void assertObjectShouldNotBeExistent() throws SQLException { assertNull(databaseManager.getObject(999)); } @Test @DisplayName("Updates an object that does not exist") public void assertUpdateNonExistentObject() throws SQLException { assertNull(databaseManager.updateObject(123, new Task(1, 2, "", ""))); } }