⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newstacktest.java

📁 Java程序设计大学教程程序源代码
💻 JAVA
字号:
/* * NewStackTest.java * JUnit based test * * Created on 2005年7月20日, 上午10:11 * * @author Liu Yi  ( http://www.liu-yi.net ) */package jbookch9;import junit.framework.*;import java.util.*;public class NewStackTest extends TestCase {        public static void main(String[] args) {        junit.textui.TestRunner.run(NewStackTest.class);    }        public NewStackTest(String testName) {        super(testName);    }        protected void setUp() throws java.lang.Exception {        super.setUp();        stack=new NewStack();    }        protected void tearDown() throws java.lang.Exception {        super.tearDown();    }        public static junit.framework.Test suite() {        junit.framework.TestSuite suite = new junit.framework.TestSuite(NewStackTest.class);        return suite;    }            /**     * pop 方法的测试(属于类 jbookch10.NewStack)。     */    public void testPop() {        System.out.println("testPop");        Object o=stack.pop();        assertNotNull(o);        assertEquals("栈底",o);    }        /**     * push 方法的测试(属于类 jbookch10.NewStack)。     */    public void testPush() {        System.out.println("testPush");        String s="testPush";        stack.push(s);        assertEquals(2, stack.getSize());        assertEquals(s, stack.pop());            }        /**     * getSize 方法的测试(属于类 jbookch10.NewStack)。     */    public void testGetSize() {        System.out.println("testGetSize");        assertEquals(1, stack.getSize());        stack.push("new item");        assertEquals(2, stack.getSize());    }        private NewStack stack;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -