Question: This is using Java JUnit public static double square Root(double num) { return Math.sqrt(num); Test value for num Expected result assertEquals() What about negative numbers????
This is using Java JUnit

public static double square Root(double num) { return Math.sqrt(num); Test value for num Expected result assertEquals() What about negative numbers???? Let's rewrite the code public static double square Root(double num) { if (num >= 0) { return Math.sqrt(num); else { return -99; Test value for num Expected result assertEquals() Now rewrite the code so it throws and exception and catches it in main How would you write a Junit test for this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
