Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What are test cases when it come to JUnit testing. Are they like seperate test f

ID: 3731317 • Letter: W

Question

What are test cases when it come to JUnit testing. Are they like seperate test file, there are instructions in my hw that have me a bit confused i will post. Im not looking for an answer i just want the instructions to be simplified. Thank you.

Create a package called test and add JUnit test cases to verify the following in your MagicSquare class:

The proper number of input values was provided.

Each of the numbers between 1 and n2 occurs exactly once in the input.

When the numbers are arranged in a matrix,

sum of the rows,

sum of columns,

and sum of diagonals

must be the same value.
Create four test cases; one where each of criteria 1, 2, 3 above fail, and one where they all pass.

Explanation / Answer

Simplification: In the problem, you are given one matrix and you have to write one JUnit test case for that. For test case there are three criteria.

1)-Sum of row

2)-Sum of column

3)-sum of diagonal

You write your test case for fail and pass both, for test case fail criteria is 'sum of row, column and diagonal must be different' and for test case pass criteria is 'sum of row, column and diagonal must be same'.

First, you need to write a driver class, then MagicSquare class which takes two input row and column and perform the operation and after that write on JUnit test case for that particular function in which you perform the operation

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote