Create BackupNotFoundExceptionTest.java

This commit is contained in:
Ludy87 2025-08-10 12:17:48 +02:00
parent 0ff57a1ed5
commit 100f9000d3
No known key found for this signature in database
GPG Key ID: 92696155E0220F94

View File

@ -0,0 +1,30 @@
package stirling.software.proprietary.security.model.exception;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class BackupNotFoundExceptionTest {
@Test
void constructor_setsMessage() {
BackupNotFoundException ex = new BackupNotFoundException("not found");
assertEquals("not found", ex.getMessage());
assertNull(ex.getCause(), "No cause expected for single-arg constructor");
}
@Test
void isRuntimeException() {
BackupNotFoundException ex = new BackupNotFoundException("x");
assertTrue(ex instanceof RuntimeException, "Should extend RuntimeException");
}
@Test
void canBeThrownAndCaught() {
try {
throw new BackupNotFoundException("missing backup");
} catch (BackupNotFoundException ex) {
assertEquals("missing backup", ex.getMessage());
}
}
}