Files
CipherStreamJava/src/test/java/com/mattrixwv/cipherstream/exceptions/InvalidInputExceptionTest.java

42 lines
1.1 KiB
Java

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