import junit.framework.TestCase;
public class CommandStackTests extends TestCase {
public void testNormal() throws Exception {
CommandStack cs = new CommandStack();
cs.setLimit(3);
cs.setUseLimit(true);
assertTrue(!cs.canRedo());
assertTrue(!cs.canUndo());
cs.put(new C());
assertTrue(!cs.canRedo());
assertTrue(cs.canUndo());
cs.put(new C());
cs.put(new C());
assertTrue(!cs.canRedo());
assertTrue(cs.canUndo());
cs.undo();
assertTrue(cs.canRedo());
assertTrue(cs.canUndo());
cs.undo();
assertTrue(cs.canRedo());
assertTrue(cs.canUndo());
cs.undo();
assertTrue(cs.canRedo());
assertTrue(!cs.canUndo());
}