Skip to content

Commit edad180

Browse files
authored
Merge pull request exercism#219 from FridaTveit/SimpleLinkedListReplaceAssertjWithJunit
Issue exercism#202: Replaced assertj assertions in simple-linked-list with jun… (fixes exercism#202)
2 parents fa08f9d + 5aaf040 commit edad180

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

‎exercises/simple-linked-list/build.gradle‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ repositories {
88

99
dependencies {
1010
testCompile "junit:junit:4.12"
11-
testCompile "org.assertj:assertj-core:3.2.0"
1211
}
1312
test {
1413
testLogging {

‎exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1+
import org.junit.Ignore;
2+
import org.junit.Test;
13

24
import java.util.NoSuchElementException;
3-
import static org.assertj.core.api.Assertions.assertThat;
4-
import org.junit.Test;
5-
import org.junit.Ignore;
5+
6+
import static org.hamcrest.CoreMatchers.*;
7+
import static org.junit.Assert.*;
68

79
public class SimpleLinkedListTest {
810

911

1012
@Test
1113
public void aNewListIsEmpty() {
1214
SimpleLinkedList list = new SimpleLinkedList();
13-
assertThat(list.size()).isEqualTo(0);
15+
assertThat(list.size(), is(0));
1416
}
1517

1618
@Ignore
1719
@Test
1820
public void canCreateFromArray() {
1921
Integer[] values = new Integer[]{1, 2, 3};
2022
SimpleLinkedList list = new SimpleLinkedList(values);
21-
assertThat(list.size()).isEqualTo(3);
23+
assertThat(list.size(), is(3));
2224
}
2325

2426
@Ignore
@@ -34,10 +36,10 @@ public void popReturnsLastAddedElement() {
3436
SimpleLinkedList list = new SimpleLinkedList();
3537
list.push(9);
3638
list.push(8);
37-
assertThat(list.size()).isEqualTo(2);
38-
assertThat(list.pop()).isEqualTo(8);
39-
assertThat(list.pop()).isEqualTo(9);
40-
assertThat(list.size()).isEqualTo(0);
39+
assertThat(list.size(), is(2));
40+
assertThat(list.pop(), is(8));
41+
assertThat(list.pop(), is(9));
42+
assertThat(list.size(), is(0));
4143
}
4244

4345
@Ignore
@@ -50,11 +52,11 @@ public void reverseReversesList() {
5052
list.push(6);
5153
list.push(5);
5254
list.reverse();
53-
assertThat(list.pop()).isEqualTo(9);
54-
assertThat(list.pop()).isEqualTo(8);
55-
assertThat(list.pop()).isEqualTo(7);
56-
assertThat(list.pop()).isEqualTo(6);
57-
assertThat(list.pop()).isEqualTo(5);
55+
assertThat(list.pop(), is(9));
56+
assertThat(list.pop(), is(8));
57+
assertThat(list.pop(), is(7));
58+
assertThat(list.pop(), is(6));
59+
assertThat(list.pop(), is(5));
5860
}
5961

6062
@Ignore
@@ -67,15 +69,15 @@ public void canReturnListAsArray() {
6769
list.push(6);
6870
list.push(5);
6971
Integer[] expected = {5, 6, 7, 8, 9};
70-
assertThat(list.asArray(Integer.class)).containsExactly(expected);
72+
assertEquals(list.asArray(Integer.class), expected);
7173
}
7274

7375
@Ignore
7476
@Test
7577
public void canReturnEmptyListAsEmptyArray() {
7678
SimpleLinkedList list = new SimpleLinkedList();
7779
Object[] expected = {};
78-
assertThat(list.asArray(Object.class)).containsExactly(expected);
80+
assertEquals(list.asArray(Object.class), expected);
7981
}
8082

8183
}

0 commit comments

Comments
 (0)