https://junit.org/junit4/
Download and install
跳到github
练习用 - junit.jar - 下载jar
expect后面接异常类
timtout后面接时间, 符合则为ture
import org.junit.Text
public class xxx{
@Text
public void xxx(){}
@Test (expected = NullPointException)
public void testNull() {
String s = null;
s.length();
}
@Test (timeOut = 1000)
public void testTimeOut() {
while(true) {
}
}
}