Question: Question 4 [JUnit Test] (10 marks) The CalculatePA class is the class to be tested. The class contains methods like perimeters ) and area() which

 Question 4 [JUnit Test] (10 marks) The CalculatePA class is theclass to be tested. The class contains methods like perimeters ) and

Question 4 [JUnit Test] (10 marks) The CalculatePA class is the class to be tested. The class contains methods like perimeters ) and area() which will be used to calculate perimeter and area of a square and print these out as string value with two decimal places. These methods need to be tested. package com.Neoh.code; public class CalculatePA { double width, height; JUnit test cases are public CalculatePA(double width, double height){ this.width = width; this.height= height; } // calculate perimeter public String perimeter(){ return String.format("%.2f", 2*(width+height)); } // calculate area public String area(){ return String.format("%.2f", width*height); } } required to test the methods mentioned above. Assume that width of square is 10 and height of square is 20. Complete the codes given below for the test cases. (10 marks) package com. Neoh.code; import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class TestCalculatePA { Complete this part with JUnit test cases to test the methods from CalculatePA }

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!