Commit 5db3514e412e6971cb25fa6e560e231cb566b07c

Authored by Adrian Chirita
1 parent 16554b41

tester innhold er forandret, flere tester

Showing 1 changed file with 12 additions and 13 deletions   Show diff stats
src/test/TwoWayLinkedListTest.java
@@ -25,20 +25,20 @@ public class TwoWayLinkedListTest { @@ -25,20 +25,20 @@ public class TwoWayLinkedListTest {
25 data.add("Pie"); 25 data.add("Pie");
26 } 26 }
27 @Test 27 @Test
28 - public void getFirst() { 28 + public void getFirstReturnsFirstElement() {
29 assertEquals("Vitkat", data.getFirst()); 29 assertEquals("Vitkat", data.getFirst());
30 } 30 }
31 @Test 31 @Test
32 - public void getLast() { 32 + public void getLastReturnsLastElement() {
33 assertEquals("Pie", data.getLast()); 33 assertEquals("Pie", data.getLast());
34 } 34 }
35 @Test 35 @Test
36 - public void addFirst() { 36 + public void addFirstPutsElementInFirstPosition() {
37 data.addFirst("newFirst"); 37 data.addFirst("newFirst");
38 assertEquals("newFirst", data.getFirst()); 38 assertEquals("newFirst", data.getFirst());
39 } 39 }
40 @Test 40 @Test
41 - public void addLast() { 41 + public void addLastPutsElementInLastPosition() {
42 data.addLast("newLast"); 42 data.addLast("newLast");
43 assertEquals("newLast", data.getLast()); 43 assertEquals("newLast", data.getLast());
44 } 44 }
@@ -54,17 +54,16 @@ public class TwoWayLinkedListTest { @@ -54,17 +54,16 @@ public class TwoWayLinkedListTest {
54 assertEquals("0", data.getFirst()); 54 assertEquals("0", data.getFirst());
55 } 55 }
56 @Test 56 @Test
57 - public void removeFirst() {  
58 - assertEquals("Vitkat",data.removeFirst());  
59 - assertEquals("Kitkat",data.getFirst()); 57 + public void removeFirstRemovesFirstElement() {
  58 + String result = data.removeFirst();
  59 + assertEquals("Vitkat",result);
  60 + assertThat(data.getFirst(),is("Kitkat"));
60 } 61 }
61 @Test 62 @Test
62 - public void removeLast() {  
63 - data.add("Kitkat");  
64 - data.add("Pie");  
65 - data.add("Oreo");  
66 - assertEquals("Oreo",data.removeLast());  
67 - assertNotEquals("Oreo",data.getLast()); 63 + public void removeLastRemovesLastElement() {
  64 + String result = data.removeLast();
  65 + assertEquals("Pie",result);
  66 + assertThat(data.getLast(),is("Vitkat"));
68 } 67 }
69 @Test 68 @Test
70 public void remove() { 69 public void remove() {