mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-16 13:47:28 +02:00
Create UnsupportedClaimExceptionTest.java
This commit is contained in:
parent
b1bb5d6a07
commit
2e8b81840f
@ -0,0 +1,45 @@
|
|||||||
|
package stirling.software.common.model.exception;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@DisplayName("Tests for UnsupportedClaimException")
|
||||||
|
class UnsupportedClaimExceptionTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("should store message passed to constructor")
|
||||||
|
void shouldStoreMessageFromConstructor() {
|
||||||
|
String expectedMessage = "This claim is not supported";
|
||||||
|
UnsupportedClaimException exception = new UnsupportedClaimException(expectedMessage);
|
||||||
|
|
||||||
|
// Verify the stored message
|
||||||
|
assertEquals(
|
||||||
|
expectedMessage,
|
||||||
|
exception.getMessage(),
|
||||||
|
"Constructor should correctly store the provided message");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("should be instance of RuntimeException")
|
||||||
|
void shouldBeInstanceOfRuntimeException() {
|
||||||
|
UnsupportedClaimException exception = new UnsupportedClaimException("msg");
|
||||||
|
|
||||||
|
// Verify that it inherits from RuntimeException
|
||||||
|
assertTrue(
|
||||||
|
exception instanceof RuntimeException,
|
||||||
|
"UnsupportedClaimException should extend RuntimeException");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("should allow null message without throwing exception")
|
||||||
|
void shouldAllowNullMessage() {
|
||||||
|
UnsupportedClaimException exception = new UnsupportedClaimException(null);
|
||||||
|
|
||||||
|
// Null message should be stored as null
|
||||||
|
assertNull(
|
||||||
|
exception.getMessage(),
|
||||||
|
"Constructor should accept null message and store it as null");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user