Files
Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidScalarException.java

42 lines
1.1 KiB
Java

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