avancement sur tests unitaires 22/11

This commit is contained in:
skferrei 2024-11-22 10:01:37 +01:00
parent 2d2ccafadc
commit f5bdc2e566

View file

@ -9,7 +9,7 @@ import static org.junit.jupiter.api.Assertions.*;
class DatabaseConnectionTest {
@Test
//@Test
void testGetConnectionSuccess() {
try (Connection connection = DatabaseConnection.getConnection()) {
assertNotNull(connection, "La connexion ne doit pas être nulle.");
@ -19,7 +19,7 @@ class DatabaseConnectionTest {
}
}
// @Test
//@Test
void testInvalidCredentials() {
// Set invalid credentials for the test
System.setProperty("DB_USER", "invalid_user");
@ -40,7 +40,7 @@ class DatabaseConnectionTest {
System.clearProperty("DB_PASSWORD");
}
// @Test
@Test
void testConnectionFailureWithInvalidUrl() {
// Set an invalid URL for the test
System.setProperty("DB_URL", "jdbc:mysql://invalid_url:3306/test_db");