package com.mattrixwv.cipherstream.exceptions; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; public class InvalidCharacterExceptionTest{ private static final String MESSAGE = "message"; private static final Throwable CAUSE = new Exception(); @Test public void testConstructor_default(){ InvalidCharacterException exception = new InvalidCharacterException(); assertNull(exception.getMessage()); assertNull(exception.getCause()); } @Test public void testConstructor_message(){ InvalidCharacterException exception = new InvalidCharacterException(MESSAGE); assertEquals(MESSAGE, exception.getMessage()); assertNull(exception.getCause()); } @Test public void testConstructor_cause(){ InvalidCharacterException exception = new InvalidCharacterException(CAUSE); assertEquals(CAUSE.toString(), exception.getMessage()); assertEquals(CAUSE, exception.getCause()); } @Test public void testConstructor_messageAndCause(){ InvalidCharacterException exception = new InvalidCharacterException(MESSAGE, CAUSE); assertEquals(MESSAGE, exception.getMessage()); assertEquals(CAUSE, exception.getCause()); } }