问题描述
可以将Intellij Idea配置为在调试期间发生JUnit java.lang.AssertionError时中断吗?
Can Intellij Idea be configured to break when a JUnit java.lang.AssertionError occurs during debugging?
我知道Intellij Idea支持在异常发生时中断的能力在调试期间,但我不确定AssertionErrors是否可以这样做。
I know that Intellij Idea supports the ability to break when exceptions occur during debugging, but I am not sure if this is possible for AssertionErrors.
当在运行单元测试之前必须准备大型应用程序上下文时,这将特别有用。
This would be particularly useful when a large application context must be prepared before unit tests can be ran.
我搜索过,但找不到这个问题的答案。
I searched, but could not find the answer to this question.
以下是我的运行方式>查看断点...> Java异常断点对话框已配置:
Here is how my Run > View Breakpoints... > Java Exception Breakpoints dialog is configured:
推荐答案
在断点对话框中,单击 +
按钮添加新断点,从下拉列表中选择Java Exception Breakpoints,然后输入 java.lang.AssertionError
作为异常类。
From the Breakpoints dialog, click the +
button to add a new breakpoint, select "Java Exception Breakpoints" from the drop-down, and then enter java.lang.AssertionError
as the exception class.
这篇关于可以将Intellij Idea配置为在发生JUnit AssertionError时中断吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!