#53 Implemented SQLite product data persistence + tests
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user