Question: PART B: JUnit Testing Write a Java program according to the following: Create a Multiple.java class. Create the following two static methods ( with return
PART B: JUnit Testing
Write a Java program according to the following:
Create a Multiple.java class. Create the following two static methods with return type float: SquareRoot and CubeRoot
SquareRoot method should take two arguments and return the float value at the end.
CubeRoot method should take three arguments and return the float value at the end.
Create a test class with the name MultipleTest.java. In this class, import the following libraries at the top of this file
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
Create an object of Calculator.java class by writing the following code in CalculatorTest.java class:
private Multiple multiple;
@Before
public void setUp
this.multiple new Multiple;
Generate the JUnit test classes for both the methods one by one. Declare and initialize the required variables to pass those to the methods. Store the expected result in one of the variables and then compare it with the actual returned value of the specific function.
After creating the required JUnit test cases for SquareRoot and CubeRoot run all the test cases one by one.
Check the output. All the test cases should be passed at the end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
