Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matrix.java import java.io.PrintStream; import java.util.Scanner; public class Matrix { private double [][] matrix; // 2D array stores matrix of size height x width int height;
Matrix.java import java.io.PrintStream; import java.util.Scanner; public class Matrix { private double [][] matrix; // 2D array stores matrix of size height x width int height; // number of rows in the matrix int width; // number of columns in the matrix public Matrix(int m, int n) { matrix = new double[m][n]; height = m; width = n; } public Matrix(Matrix mtx) { height = mtx.getHeight(); width = mtx.getWidth(); matrix = new double[height][width]; for (int i = 0; i 0) { row += matrix[i][0]; } // Remaining columns for (int j = 1; jMatrixTest.java import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; /* Test failure record: * 1. [Name of test method] [Method that failed] [Notes] * 2. * 3. * 4. * 5. * ... */ class MatrixTest { @Test void testEquals() { } @Test void negate() { } @Test void add() { } @Test void multiplyWithScalar() { } @Test void multiplyWithMatrix() { } @Test void getElem() { } @Test void setElem() { } @Test void getHeight() { } @Test void getWidth() { } }IntelliJ is the ide used, please explain to help me learn, thanks.
1. Create a set of unit tests for the methods: Matrix add(Matrix b, Matrix res) Matrix multiplyWithScalar (double s, Matrix res) Matrix multiplyWithMatrix (Matrix b, Matrix res) Your tests should detect at least 2 or more defects. You can stop once you reach 8 meaningful (and non-redundant) tests. 2. In MatrixTest.java Implement the tests. For each test, be sure to a. Properly name each test b. Have a description of each test's purpose in the comment block above the test. C. Identify if the test is a white box or black box test d. Include any reasonable assumptions that the test is making. 3. Execute your JUnit tests. Reporting and analysis 4. At the top of the test file, in the provided comment block, list which tests failed. Note: you do not need to fix the errors. For each failed test, please include: a. Name of method being tested b. Name of test method C. Suggest a way that the bug revealed by the test can be fixed. d. Any additional comments or analysis that the test revealed. 5. If you have time, create additional tests for other methods. 6. Commit and push the test class that you updated. 1. Create a set of unit tests for the methods: Matrix add(Matrix b, Matrix res) Matrix multiplyWithScalar (double s, Matrix res) Matrix multiplyWithMatrix (Matrix b, Matrix res) Your tests should detect at least 2 or more defects. You can stop once you reach 8 meaningful (and non-redundant) tests. 2. In MatrixTest.java Implement the tests. For each test, be sure to a. Properly name each test b. Have a description of each test's purpose in the comment block above the test. C. Identify if the test is a white box or black box test d. Include any reasonable assumptions that the test is making. 3. Execute your JUnit tests. Reporting and analysis 4. At the top of the test file, in the provided comment block, list which tests failed. Note: you do not need to fix the errors. For each failed test, please include: a. Name of method being tested b. Name of test method C. Suggest a way that the bug revealed by the test can be fixed. d. Any additional comments or analysis that the test revealed. 5. If you have time, create additional tests for other methods. 6. Commit and push the test class that you updated
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started