Skip to content

Commit da51635

Browse files
author
Kay Hudson
committed
Add test descriptions
1 parent 6f78ebe commit da51635

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/test/java/StackTestCase.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import org.junit.Test;
2-
import static org.junit.Assert.*;
1+
import org.junit.jupiter.api.DisplayName;
2+
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.*;
34

45
import com.galvanize.Stack;
56

67
public class StackTestCase {
78

8-
@Test
9+
@Test()
10+
@DisplayName("Stack.push() adds a new object")
911
public void testStackPush() {
1012
Stack newStack = new Stack();
1113
assertEquals(0, newStack.count());
@@ -15,6 +17,7 @@ public void testStackPush() {
1517
}
1618

1719
@Test
20+
@DisplayName("Stack.pop() removes and returns last item added.")
1821
public void testStackPopRemovesAndReturnsLastItemIn() {
1922
Stack newStack = new Stack();
2023
newStack.push(1);
@@ -27,10 +30,11 @@ public void testStackPopRemovesAndReturnsLastItemIn() {
2730
}
2831

2932
@Test
33+
@DisplayName("Stack.peek() returns the last item added without removing it.")
3034
public void testStackPeek() {
3135
Stack newStack = new Stack();
32-
newStack.push(1);
33-
newStack.push(2);
34-
assertEquals(2, newStack.peek());
36+
newStack.push("sock");
37+
newStack.push("shoe");
38+
assertEquals("shoe", newStack.peek());
3539
}
3640
}

0 commit comments

Comments
 (0)