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

请教一下, 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);
    }
阅读 2.8k
1 个回答

我就想知道,有没有个异常类叫fail......

代码不一样啊,我从github上下的4.12的源码
clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进