Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions