Question: Consider the class Calculation below. It has 3 static methods findMax, cube, and reverseWords. Also provided is the test class TestCalculation which has all the

Consider the class Calculation below. It has 3 static methods findMax, cube, and reverseWords. Also provided is the test class TestCalculation which has all the library imports and some of the methods predefined. Add test methods that test all static methods of Calculation class. For findMax method, ensure that you test for both positive and negative integers. You can assume that all necessary imports are already provided. public class Calculation { //method that returns maximum number public static int findMax(int arr[]) { int max=0; for (int i=1;inn; } //method that returns reverse words. E.g., "hello world" is returned as "olleh dlrow" public static String reverseWord(String str) { StringBuilder result=new StringBuilder(); StringTokenizer tokenizer=new StringTokenizer(str," "); while (tokenizer.hasMoreTokens()) { StringBuilder sb=new StringBuilder(); sb.append(tokenizer.nextToken()); sb.reverse(); result.append(sb); result.append(" "); } return result.toString(); } } import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import com.javatpoint.logic.Calculation; public class TestCalculation { @BeforeClass public static void setUpBeforeClass() throws Exception { System.out.println("before class"); } @Before public void setUp() throws Exception { System.out.println("before"); } @After public void tearDown() throws Exception { System.out.println("after"); } @AfterClass public static void tearDownAfterClass() throws Exception { System.out.println("after class"); } }

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!