Question: Java script public class Utils public static int[] StringToArrayInt(String inputString) { return output IntArray: import org.junit. Test; import static org.junit. Assert.*; // class public class

 Java script public class Utils public static int[] StringToArrayInt(String inputString) {return output IntArray: import org.junit. Test; import static org.junit. Assert.*; // class

public class My Test { @Test // method public void testOne() {

Java script

public class Utils public static int[] StringToArrayInt(String inputString) { return output IntArray: import org.junit. Test; import static org.junit. Assert.*; // class public class My Test { @Test // method public void testOne() { int returnedArray[] = {}; int answer IntegerTest1[] int answer IntegerTest2[] = {}; {}; = // Test 1 Input and Desired Output System.out.println("Subtest 1: input string is 1 2 3 4"); String myStringTest1 = new String("1 2 3 4"); answer IntegerTest1 = new int[]{1, 2, 3, 4); // desired returned int array. returnedArray = Utils.StringToArrayInt (myStringTest1); // Check that returned array is equal to the model. assertArrayEquals(returnedArray, answer IntegerTest1); // Test 2 Input and Desired Output System.out.println("Subtest 2: input string is 20 30 40 50 60 70 80"); String myStringTest2 = new String("20 30 40 50 60 70 80"); answer IntegerTest2 = new int[]{20, 30, 40, 50, 60, 70, 80}; // desired returned int array. returnedArray = Utils.StringToArrayInt(myStringTest2); 1/ Check that returned array is equal to the model. assertArray Equals(returnedArray, answer IntegerTest2); // //assertArrayEquals(expected, array); } // end method } // end class 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 Unit test file) 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 Unit test file)

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!