文字列配列をさまざまな方法で並べ替える3つのクラスをテストしようとしています。
配列を初期化してから、すべてのテストでそれらを使用するメソッドがあることを私は知っています。
これまでのところ、これは私のコードです:
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"};
}
}
setUpメソッドとinitializeメソッドの両方を試しましたが、xが見つからないようですが、何が間違っているのでしょうか。