testmath.java

来自「junit中的软件设计模式 源代码,看了挺有收获的」· Java 代码 · 共 42 行

JAVA
42
字号
package junit.example;

import junit.framework.TestCase;

public class Testmath extends TestCase {
    private math math = null;

    public Testmath(String name) {
        super(name);
    }

    protected void setUp() throws Exception {
        super.setUp();
        /**@todo verify the constructors*/
        math = new math();
    }

    protected void tearDown() throws Exception {
        math = null;
        super.tearDown();
    }

    public void testAdd() {
        int a =10;
        int b = 0;
        int expectedReturn = 0;
        int actualReturn = math.add(a, b);
        assertEquals("return value", new Integer(expectedReturn), new Integer(actualReturn));
        /**@todo fill in the test code*/
    }

    public void testSubtract() {
        int a = 1;
        int b = 0;
        int expectedReturn = 70;
        int actualReturn = math.subtract(a, b);
        //assertEquals("return value", expectedReturn, actualReturn);
        /**@todo fill in the test code*/
    }

}

⌨️ 快捷键说明

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