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