我已经在其他地方发布了这个,没有解决方案,所以也在这里发布。由于num小于5,下面提到的代码没有像我期望的那样抛出断言错误。希望有人能提供建议。谢谢。断言错误问题
public class Wrong {
public static void main(String[] args) {
Wrong wrong = new Wrong();
wrong.methodE(3);
}
//AssertionError
void methodE(int num)
{
assert(num>5);
}
}
答案,但对于更多的'assert'在Java中检查出这个线程:http://stackoverflow.com/questions/2758224/assertion-in-java – Durandal