Question
The code should pass the junit test public static int[] task4(int[] seq) { int[] result = null; int size=0; int prevIndex = -1; for(int i=0;i
The code should pass the junit test public static int[] task4(int[] seq) { int[] result = null; int size=0; int prevIndex = -1; for(int i=0;i JUNIT TEST @Test public void test_task4_1() { int[] seq = {3, 1, 1, 1, 2, 2, 2, 2}; int[] expected = {1, 3, 3, 1, 4, 2}; assertArrayEquals(expected, Utilities.task4(seq)); } @Test public void test_task4_2() { int[] seq = {1, 1, 1, 2, 2, 2, 2}; int[] expected = {3, 1, 4, 2}; assertArrayEquals(expected, Utilities.task4(seq)); } @Test public void test_task4_3() { int[] seq = {2, 2, 2, 2, 1, 1, 1}; int[] expected = {4, 2, 3, 1}; assertArrayEquals(expected, Utilities.task4(seq)); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started