浏览代码

simple-linked-list: fix array compartison in tests

Replace deprecated methods and ensure order of arguments is correct.
Frida Johanne Tveit 9 年前
父节点
当前提交
ab9a7af8e0
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4
    4
      exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java

+ 4
- 4
exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java 查看文件

1
 import org.junit.Ignore;
1
 import org.junit.Ignore;
2
-import org.junit.Test;
3
 import org.junit.Rule;
2
 import org.junit.Rule;
3
+import org.junit.Test;
4
 import org.junit.rules.ExpectedException;
4
 import org.junit.rules.ExpectedException;
5
 
5
 
6
 import java.util.NoSuchElementException;
6
 import java.util.NoSuchElementException;
12
 
12
 
13
     @Rule
13
     @Rule
14
     public ExpectedException thrown = ExpectedException.none();
14
     public ExpectedException thrown = ExpectedException.none();
15
-    
15
+
16
     @Test
16
     @Test
17
     public void aNewListIsEmpty() {
17
     public void aNewListIsEmpty() {
18
         SimpleLinkedList list = new SimpleLinkedList();
18
         SimpleLinkedList list = new SimpleLinkedList();
74
         list.push(6);
74
         list.push(6);
75
         list.push(5);
75
         list.push(5);
76
         Integer[] expected = {5, 6, 7, 8, 9};
76
         Integer[] expected = {5, 6, 7, 8, 9};
77
-        assertEquals(list.asArray(Integer.class), expected);
77
+        assertArrayEquals(expected, list.asArray(Integer.class));
78
     }
78
     }
79
 
79
 
80
     @Ignore("Remove to run test")
80
     @Ignore("Remove to run test")
82
     public void canReturnEmptyListAsEmptyArray() {
82
     public void canReturnEmptyListAsEmptyArray() {
83
         SimpleLinkedList list = new SimpleLinkedList();
83
         SimpleLinkedList list = new SimpleLinkedList();
84
         Object[] expected = {};
84
         Object[] expected = {};
85
-        assertEquals(list.asArray(Object.class), expected);
85
+        assertArrayEquals(expected, list.asArray(Object.class));
86
     }
86
     }
87
 
87
 
88
 }
88
 }