From the course: Java: Testing with JUnit

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Custom messages and reports

Custom messages and reports

- [Instructor] All right, let's talk about options for creating custom messages and reports. First of all, we have seen display name already. Second, we saw that we could add a custom message as a third argument for assertions. And what we'll also see, and this is new, is the Surefire plugin that we can use. So first of all, we have seen display name already. With the annotation "@DisplayName", we could add a custom message to our report. And what we also saw was that we could add a third argument to assertEquals. So, for example, here, we could specify and insert a custom message, for example, "Unexpected value, expected 900". Clearly, this is not going to be very informative. This was what the test would also be saying, but in order to get this message on the screen, we have to make sure that the test is going to fit. Let me run this again. And if I scroll down a bit, you can see here, our custom message, "Unexpected…

Contents