mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-11 13:48:37 +02:00
Create NoProviderFoundExceptionTest.java
This commit is contained in:
parent
100f9000d3
commit
dace926400
@ -0,0 +1,33 @@
|
||||
package stirling.software.proprietary.security.model.exception;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class NoProviderFoundExceptionTest {
|
||||
|
||||
@Test
|
||||
void constructor_setsMessage_withoutCause() {
|
||||
NoProviderFoundException ex = new NoProviderFoundException("no provider");
|
||||
assertEquals("no provider", ex.getMessage());
|
||||
assertNull(ex.getCause(), "Cause should be null for single-arg constructor");
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructor_setsMessage_andCause() {
|
||||
Throwable cause = new IllegalStateException("root");
|
||||
NoProviderFoundException ex = new NoProviderFoundException("missing", cause);
|
||||
|
||||
assertEquals("missing", ex.getMessage());
|
||||
assertSame(cause, ex.getCause());
|
||||
}
|
||||
|
||||
@Test
|
||||
void canBeThrownAndCaught_checkedException() {
|
||||
try {
|
||||
throw new NoProviderFoundException("boom");
|
||||
} catch (NoProviderFoundException ex) {
|
||||
assertEquals("boom", ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user