Skip to content

Commit

Permalink
add assertion about state of stack, and popped element (must follow L…
Browse files Browse the repository at this point in the history
…IFO)
  • Loading branch information
truongdangqe committed Jun 8, 2021
1 parent c53ace8 commit 70b99b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/test/Java/TestStack.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import org.junit.Assert;
import org.junit.Test;

public class TestStack {
/**
* Currently I don't assert anything. Just look at the console log.
*/

@Test
public void testStack() {
//creating an instance of Stack class
Stack<Integer> stk= new Stack<>();

// checking stack is empty or not
boolean result = stk.isEmpty();
Assert.assertTrue(result == true);
System.out.println("Is the stack empty? " + result);

// pushing elements into stack
Expand All @@ -23,6 +23,7 @@ public void testStack() {

// remove element at top of the stack
Integer i = stk.pop();
Assert.assertTrue(i == 120);
System.out.println(String.format("Removing %s ...", i));
stk.print();

Expand Down

0 comments on commit 70b99b6

Please sign in to comment.