I am trying to test my 3 classes that sort string arrays differently!
I know that there is a method that initializes the array and then uses them in each of my tests.
So far this is my code:
public class SortingTest { public insertionSort is = new insertionSort(); public bubbleSort bs = new bubbleSort(); @Test public void testBubbleSort() { String [] sortedArray ={"Chesstitans", "Ludo", "Monkey", "Palle"}; bs.sort(sortedArray); assertArrayEquals(sortedArray, x); } @Test public void testInsertionSort() { } @Test public void testMergeSort() { } @Test public void testSelectionSort() { } @Before protected void setUp() throws Exception{ String[]x ={"Ludo", "Chesstitans", "Palle", "Monkey"}; } }
Despite the fact that I tried both the setUp and initialize methods, it doesn't seem to find x, what did I do wrong?
source share