Contents
Setting the name of a test in JUnit
Changing the name of a test can be done by either changing the method name or by using the @DisplayName annotation. In the following example, you see the @DisplayName annotation on the class and the test method.
Placing the @DisplayName changes the name of the class. When you put @DisplayName on a test method it will change the name of the test method.
|
|
The names of the test will now look different in the console. When you run the previous tests in IntelliJ the result will look like the following:
Further reading
More about testing in Java: