Dan Torrey
Dan Torrey

Reputation: 1469

Can Intellij Idea be configured to break when a JUnit AssertionError occurs?

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:

enter image description here

Upvotes: 15

Views: 3566

Answers (1)

Mike Strobel
Mike Strobel

Reputation: 25623

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.

Upvotes: 27

Related Questions