mirror of
https://bitbucket.org/Mattrixwv/matrix.git
synced 2025-12-06 15:03:58 -05:00
Updated libraries and increased test coverage
This commit is contained in:
42
pom.xml
42
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.mattrixwv</groupId>
|
||||
<artifactId>matrix</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
|
||||
<name>Matrix</name>
|
||||
<url>https://www.mattrixwv.com</url>
|
||||
@@ -14,12 +14,13 @@
|
||||
<properties>
|
||||
<!--Compile-->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>18</java.version>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>19</java.version>
|
||||
<maven.compiler.source>19</maven.compiler.source>
|
||||
<maven.compiler.target>19</maven.compiler.target>
|
||||
|
||||
<!--Sonarqube-->
|
||||
<sonar.java.source>18</sonar.java.source>
|
||||
<sonar.java.source>19</sonar.java.source>
|
||||
<sonar.dependencyCheck.jsonReportPath>target/dependency-check-report.json</sonar.dependencyCheck.jsonReportPath>
|
||||
<sonar.dependencyCheck.htmlReportPath>target/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath>
|
||||
</properties>
|
||||
@@ -28,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.9.0</version>
|
||||
<version>5.9.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -39,7 +40,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
@@ -64,11 +65,11 @@
|
||||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<release>${java.version}</release>
|
||||
<compilerArgs>
|
||||
@@ -80,38 +81,43 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>3.1.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>3.1.1</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.12.0</version>
|
||||
<version>3.12.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.2</version>
|
||||
</plugin>
|
||||
<!--Versions-->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.15.0</version>
|
||||
<configuration>
|
||||
<rulesUri>file://${session.executionRootDirectory}/version-rules.xml</rulesUri>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</plugin>
|
||||
<!--Sonarqube-->
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
@@ -121,7 +127,7 @@
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.8</version>
|
||||
<version>0.8.9</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jacoco-initialize</id>
|
||||
@@ -142,7 +148,7 @@
|
||||
<plugin>
|
||||
<groupId>org.owasp</groupId>
|
||||
<artifactId>dependency-check-maven</artifactId>
|
||||
<version>7.1.1</version>
|
||||
<version>8.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>none</phase>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/TestBigBigIntegerMatrix.java
|
||||
//Mattrixwv
|
||||
// Created: 02-10-22
|
||||
//Modified: 07-09-22
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix;
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ public class TestBigIntegerMatrix{
|
||||
public void testEquals(){
|
||||
//Invalid equals
|
||||
BigIntegerMatrix matrix = new BigIntegerMatrix(grid1);
|
||||
assertNotEquals(null, matrix);
|
||||
assertNotEquals(new int[0], matrix);
|
||||
assertNotEquals(matrix, null);
|
||||
assertNotEquals(matrix, new int[0]);
|
||||
|
||||
//1x1
|
||||
boolean gridEquals = matrix.equals(matrix);
|
||||
@@ -1858,4 +1858,38 @@ public class TestBigIntegerMatrix{
|
||||
String matrixString = "[1,2,3]\n[1,2,3]\n[1,2,3]";
|
||||
assertEquals(matrixString, matrix.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaplaceExpansionHelper(){
|
||||
BigIntegerMatrixPublic matrix = new BigIntegerMatrixPublic();
|
||||
matrix.addRow(grid2[0]);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
BigIntegerMatrixPublic matrix2 = new BigIntegerMatrixPublic();
|
||||
matrix2.setGrid(grid1);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix2.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
BigIntegerMatrixPublic matrix3 = new BigIntegerMatrixPublic();
|
||||
matrix3.setGrid(grid2);
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(-1, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(2, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, -1);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class BigIntegerMatrixPublic extends BigIntegerMatrix{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java
|
||||
//Mattrixwv
|
||||
// Created: 02-07-22
|
||||
//Modified: 07-09-22
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix;
|
||||
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
@@ -200,8 +199,8 @@ public class TestDoubleMatrix{
|
||||
public void testEquals(){
|
||||
//Invalid equals
|
||||
DoubleMatrix matrix = new DoubleMatrix(grid1);
|
||||
assertNotEquals(null, matrix);
|
||||
assertNotEquals(new int[0], matrix);
|
||||
assertNotEquals(matrix, null);
|
||||
assertNotEquals(matrix, new int[0]);
|
||||
|
||||
//1x1
|
||||
matrix = new DoubleMatrix(grid1);
|
||||
@@ -1851,4 +1850,38 @@ public class TestDoubleMatrix{
|
||||
String matrixString = "[0.5,1.5,2.5]\n[0.5,1.5,2.5]\n[0.5,1.5,2.5]";
|
||||
assertEquals(matrixString, matrix.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaplaceExpansionHelper(){
|
||||
DoubleMatrixPublic matrix = new DoubleMatrixPublic();
|
||||
matrix.addRow(grid2[0]);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
DoubleMatrixPublic matrix2 = new DoubleMatrixPublic();
|
||||
matrix2.setGrid(grid1);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix2.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
DoubleMatrixPublic matrix3 = new DoubleMatrixPublic();
|
||||
matrix3.setGrid(grid2);
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(-1, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(2, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, -1);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class DoubleMatrixPublic extends DoubleMatrix{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java
|
||||
//Mattrixwv
|
||||
// Created: 02-01-22
|
||||
//Modified: 07-09-22
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix;
|
||||
|
||||
|
||||
@@ -199,8 +199,8 @@ public class TestIntegerMatrix{
|
||||
public void testEquals(){
|
||||
//Invalid equals
|
||||
IntegerMatrix matrix = new IntegerMatrix(grid1);
|
||||
assertNotEquals(null, matrix);
|
||||
assertNotEquals(new double[0], matrix);
|
||||
assertNotEquals(matrix, null);
|
||||
assertNotEquals(matrix, new double[0]);
|
||||
|
||||
//1x1
|
||||
matrix = new IntegerMatrix(grid1);
|
||||
@@ -1849,4 +1849,38 @@ public class TestIntegerMatrix{
|
||||
String matrixString = "[1,2,3]\n[1,2,3]\n[1,2,3]";
|
||||
assertEquals(matrixString, matrix.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaplaceExpansionHelper(){
|
||||
IntegerMatrixPublic matrix = new IntegerMatrixPublic();
|
||||
matrix.addRow(grid2[0]);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
IntegerMatrixPublic matrix2 = new IntegerMatrixPublic();
|
||||
matrix2.setGrid(grid1);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix2.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
IntegerMatrixPublic matrix3 = new IntegerMatrixPublic();
|
||||
matrix3.setGrid(grid2);
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(-1, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(2, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, -1);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class IntegerMatrixPublic extends IntegerMatrix{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java
|
||||
//Mattrixwv
|
||||
// Created: 02-10-22
|
||||
//Modified: 07-09-22
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix;
|
||||
|
||||
|
||||
@@ -198,8 +198,8 @@ public class TestLongMatrix{
|
||||
public void testEquals(){
|
||||
//Invalid equals
|
||||
LongMatrix matrix = new LongMatrix(grid1);
|
||||
assertNotEquals(null, matrix);
|
||||
assertNotEquals(new int[0], matrix);
|
||||
assertNotEquals(matrix, null);
|
||||
assertNotEquals(matrix, new int[0]);
|
||||
|
||||
//1x1
|
||||
matrix = new LongMatrix(grid1);
|
||||
@@ -1849,4 +1849,38 @@ public class TestLongMatrix{
|
||||
String matrixString = "[1,2,3]\n[1,2,3]\n[1,2,3]";
|
||||
assertEquals(matrixString, matrix.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaplaceExpansionHelper(){
|
||||
LongMatrixPublic matrix = new LongMatrixPublic();
|
||||
matrix.addRow(grid2[0]);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
LongMatrixPublic matrix2 = new LongMatrixPublic();
|
||||
matrix2.setGrid(grid1);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix2.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
LongMatrixPublic matrix3 = new LongMatrixPublic();
|
||||
matrix3.setGrid(grid2);
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(-1, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(2, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, -1);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class LongMatrixPublic extends LongMatrix{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//Matrix/src/test/java/com/mattixwv/matrix/TestModMatrix.java
|
||||
//Mattrixwv
|
||||
// Created: 02-09-22
|
||||
//Modified: 07-09-22
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix;
|
||||
|
||||
|
||||
@@ -137,8 +137,8 @@ public class TestModMatrix{
|
||||
public void testEquals(){
|
||||
//Invalid equals
|
||||
ModMatrix matrix = new ModMatrix(grid1, 26);
|
||||
assertNotEquals(null, matrix);
|
||||
assertNotEquals(new double[0], matrix);
|
||||
assertNotEquals(matrix, null);
|
||||
assertNotEquals(matrix, new double[0]);
|
||||
|
||||
//1x1
|
||||
matrix = new ModMatrix(grid1, 26);
|
||||
@@ -1837,4 +1837,41 @@ public class TestModMatrix{
|
||||
String matrixString = "[1,2,3]\n[1,2,3]\n[1,2,3]\nmod(26)";
|
||||
assertEquals(matrixString, matrix.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaplaceExpansionHelper(){
|
||||
ModMatrixPublic matrix = new ModMatrixPublic();
|
||||
matrix.addRow(grid2[0]);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
ModMatrixPublic matrix2 = new ModMatrixPublic();
|
||||
matrix2.setGrid(grid1);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix2.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
ModMatrixPublic matrix3 = new ModMatrixPublic();
|
||||
matrix3.setGrid(grid2);
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(-1, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(2, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, -1);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class ModMatrixPublic extends ModMatrix{
|
||||
public ModMatrixPublic(){
|
||||
super(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidCoordinatesException.java
|
||||
//Mattrixwv
|
||||
// Created: 04-13-23
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix.exceptions;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
public class TestInvalidCoordinatesException{
|
||||
private String message = "message";
|
||||
private Throwable cause = new Exception();
|
||||
|
||||
|
||||
@Test
|
||||
public void testConstructor(){
|
||||
InvalidCoordinatesException exception = new InvalidCoordinatesException();
|
||||
assertNull(exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidCoordinatesException(message);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidCoordinatesException(cause);
|
||||
assertEquals(cause.toString(), exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
|
||||
exception = new InvalidCoordinatesException(message, cause);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidGeometryException.java
|
||||
//Mattrixwv
|
||||
// Created: 04-13-23
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix.exceptions;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
public class TestInvalidGeometryException{
|
||||
private String message = "message";
|
||||
private Throwable cause = new Exception();
|
||||
|
||||
|
||||
@Test
|
||||
public void testConstructor(){
|
||||
InvalidGeometryException exception = new InvalidGeometryException();
|
||||
assertNull(exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidGeometryException(message);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidGeometryException(cause);
|
||||
assertEquals(cause.toString(), exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
|
||||
exception = new InvalidGeometryException(message, cause);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidRowSizeException.java
|
||||
//Mattrixwv
|
||||
// Created: 04-13-23
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix.exceptions;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
public class TestInvalidRowSizeException{
|
||||
private String message = "message";
|
||||
private Throwable cause = new Exception();
|
||||
|
||||
|
||||
@Test
|
||||
public void testConstructor(){
|
||||
InvalidRowSizeException exception = new InvalidRowSizeException();
|
||||
assertNull(exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidRowSizeException(message);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidRowSizeException(cause);
|
||||
assertEquals(cause.toString(), exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
|
||||
exception = new InvalidRowSizeException(message, cause);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidScalarException.java
|
||||
//Mattrixwv
|
||||
// Created: 04-13-23
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix.exceptions;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
public class TestInvalidScalarException{
|
||||
private String message = "message";
|
||||
private Throwable cause = new Exception();
|
||||
|
||||
|
||||
@Test
|
||||
public void testConstructor(){
|
||||
InvalidScalarException exception = new InvalidScalarException();
|
||||
assertNull(exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidScalarException(message);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new InvalidScalarException(cause);
|
||||
assertEquals(cause.toString(), exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
|
||||
exception = new InvalidScalarException(message, cause);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestNullMatrixException.java
|
||||
//Mattrixwv
|
||||
// Created: 04-13-23
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix.exceptions;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
public class TestNullMatrixException{
|
||||
private String message = "message";
|
||||
private Throwable cause = new Exception();
|
||||
|
||||
|
||||
@Test
|
||||
public void testConstructor(){
|
||||
NullMatrixException exception = new NullMatrixException();
|
||||
assertNull(exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new NullMatrixException(message);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
|
||||
exception = new NullMatrixException(cause);
|
||||
assertEquals(cause.toString(), exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
|
||||
exception = new NullMatrixException(message, cause);
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user