看Junit源代码,看到throw new fail (),没看明白,请教一下

xiayiguo 2016-11-25 05:25:09
请教一下, fail不是一个方法吗?为什么需要new?



  /**
* Fails a test with the given message.
*
* @param message the identifying message for the {@link AssertionError} (<code>null</code>
* okay)
* @see AssertionError
*/
static public void fail(String message) {
if (message == null) {
throw new fail();
}
throw new fail(message);
}

/**
* Fails a test with no message.
*/
static public void fail() {
fail(null);
}
...全文
82 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧