Question: Question 1 ) Details You are given Arthmatic.java You must write JUnit tests for all of the methods in the class. At least 5 different

Question 1) Details
You are given Arthmatic.java You must write JUnit tests for all of the methods in the class. At least 5 different tests for each method. Once you write one of the tests for a specific method, the other 4 can be easily produced by copying/pasting the first one and adjusting the input/output parameters. it is important to test boundary inputs as most of the bugs are usually
found in those edge cases. If your tests cases are failing, because there is a bug in the given code, then it is okay. You are not required to fix the code; you just need to write the test cases for this assignment.
public class Arthmatic {
public int multiply(int operand1, int operand2){
return operand1* operand2;
}
public int subtract(int operand1, int operand2){
return operand1- operand2;
}
public int add(int operand1, int operand2){
return operand1+ operand2;
}
public int divide(int operand1, int operand2){
if(divideByZero(operand2)){
//return a integer flag
return Integer.MAX_VALUE;
}else {
return operand1/operand2;
}
}
public boolean divideByZero(int operand2){
if(operand2==0){
return true;
}else {
return false;
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!