Can Intellij Idea be configured to break when a JU

2019-06-15 13:24发布

问题:

Can Intellij Idea be configured to break when a JUnit java.lang.AssertionError occurs during debugging?

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.

Here is how my Run > View Breakpoints... > Java Exception Breakpoints dialog is configured:

回答1:

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.