Question: Need help debugging this Java code please.(Question on the side) * Utils.java 1 2 - public class { 3 @Test 4 // method 5 public

Need help debugging this Java code please.(Question on the side)
* Utils.java 1 2 - public class { 3 @Test 4 // method 5 public void testOne() { 6 7 int returnedArray[] = {}: 8 int answer IntegerTesti[] = {}; int answer IntegerTest2[] = {}; 9 // // Test 1 Input and Desired Output System.out.println("Subtest 1: input string is 1 2 3 4"); String myStringTesti = new String("1 2 3 4"); answer IntegerTesti = new int[]{1, 2, 3, 4}; // desire returnedArray = Utils.StringToArrayInt(myStringTesti); // Check that returned array is equal to the model. assertArrayEquals(returnedArray, answer IntegerTesti); [Note: the error & lack of clarity in this question was brought up in class on Jan. 19) A String will be passed to your method by VPL's internal tester. The String contains a series of whole numbers, separated by spaces. Your method is expected to return an array of integers. These integers should be the same, and in the same order, as the numbers in the String. (download the JUnit test file) wnuBHmww% 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 // Test 2 Input and Desired Output System.out.println("Subtest 2: input string is 20 30 40 50 String myStringTest2 = new String("20 30 40 50 60 70 80"); answerintegerTest2 = new int[]{20, 30, 40, 50, 60, 70, 80); returnedArray = Utils.StringToArrayInt (myStringTest2); // Check that returned array is equal to the model. assertArrayEquals(returnedArray, answer IntegerTest2); One test will send String("1 2 3 4") to your method. It will expect int[]{1, 2, 3, 4} back (you can see that in the JUnit test file). This is due on the Sunday before Lab Bin Module 3. //assertArrayEquals(expected, array); } // end method } // end class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
