mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-11 13:48:37 +02:00
Create BackupNotFoundExceptionTest.java
This commit is contained in:
parent
0ff57a1ed5
commit
100f9000d3
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user