#53 Implemented SQLite product data persistence + tests

This commit is contained in:
Marvin Scham
2023-06-07 23:17:59 +02:00
parent 0a42a38016
commit 5a6ff71839
27 changed files with 880 additions and 34 deletions

View File

@@ -0,0 +1,28 @@
package de.rwu.easydrop.exception;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import org.junit.jupiter.api.Test;
class PersistenceExceptionTest {
@Test
void testPersistenceExceptionWithMessage() {
String errorMessage = "Error occurred during data persistence.";
PersistenceException exception = new PersistenceException(errorMessage);
assertEquals(errorMessage, exception.getMessage());
assertNull(exception.getCause());
}
@Test
void testPersistenceExceptionWithMessageAndCause() {
String errorMessage = "Error occurred during data persistence.";
Throwable cause = new IllegalArgumentException("Invalid argument.");
PersistenceException exception = new PersistenceException(errorMessage, cause);
assertEquals(errorMessage, exception.getMessage());
assertEquals(cause, exception.getCause());
}
}