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 the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f31f7057576_32766f31f6fbac5b.jpg)

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
Get step-by-step solutions from verified subject matter experts
