KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > core > util > StringStackTest


1 package com.thoughtworks.xstream.core.util;
2
3 import junit.framework.TestCase;
4
5 public class StringStackTest extends TestCase {
6
7     public void test() {
8         StringStack stack = new StringStack(2);
9
10         stack.push("a");
11         stack.push("b");
12         stack.push("c");
13         stack.push("d");
14
15         assertEquals("d", stack.peek());
16         assertEquals("d", stack.peek());
17         assertEquals("d", stack.pop());
18         assertEquals("c", stack.pop());
19         stack.popSilently();
20         assertEquals("a", stack.peek());
21         assertEquals("a", stack.pop());
22     }
23 }
24
Popular Tags