예제 #1
0
 /** A simple test to show that top() is working correctly when items are being pushed/popped */
 @Ignore
 @Test
 public void testPushPopTop() {
   final StackIF<String> stack = makeStringStack();
   stack.push(values[2]);
   assertEquals("The top item of the stack should be 'Three'", stack.top(), "Three");
   stack.push(values[2]);
   stack.push(values[0]);
   stack.pop();
   assertEquals("The top item of the stack should be 'Three'", stack.top(), "Three");
   stack.pop();
   stack.push(values[1]);
   stack.push(values[1]);
   stack.pop();
   assertEquals("The top item of the stack should be 'Two'", stack.top(), "Two");
 }
예제 #2
0
 /** Tests that calling top on an empty stack throws a StackUnderflowException. */
 @Ignore
 @Test(expected = StackUnderflowException.class)
 public void topOnEmptyThrowsException() {
   final StackIF<Integer> stack = makeIntegerStack();
   stack.top();
 }