JUnit4_1

@Test

最简单的一个例子:

T.java

/**
*
*/
package com.ailk;

/**
* @author Administrator
*
*/
public class T {
    public int add(int a, int b) {
        return a + b;
    }
}

TTest.java

/**
*
*/
package com.ailk;

import static org.junit.Assert.*;

import org.junit.Test;

/**
* @author Administrator
*
*/
public class TTest {

    /**
     * Test method for {@link com.ailk.T#add(int, int)}.
     */
    @Test
    public void testAdd() {
        T t = new T();
        assertEquals(8, t.add(3, 5));
    }

}

原文地址:https://www.cnblogs.com/holy/p/2046960.html