package io.ljunggren.sendgrid.api.exception;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import org.junit.jupiter.api.Test;
class SendgridExceptionTest {
@Test
void messageOnlyConstructor_setsMessage() {
SendgridException ex = new SendgridException("boom");
assertEquals("boom", ex.getMessage());
assertNull(ex.getCause());
}
@Test
void causeOnlyConstructor_setsCause() {
Throwable cause = new IllegalStateException("inner");
SendgridException ex = new SendgridException(cause);
assertSame(cause, ex.getCause());
}
@Test
void messageAndCauseConstructor_setsBoth() {
Throwable cause = new RuntimeException("rt");
SendgridException ex = new SendgridException("wrap", cause);
assertEquals("wrap", ex.getMessage());
assertSame(cause, ex.getCause());
}
}