Note that the test class is annotated with the @ExtendWith annotation where its value is the SpringExtension.class:

@ExtendWith(SpringExtension.class)

The SpringExtension class integrates the Spring TestContext Framework into JUnit 5’s Jupiter programming model and the @ExtendWith annotation allows us to register the extension for the annotated test class.

In the above example, we have used few JUnit 5 annotations like @Test, @DisplayName.

7. Running JUnit 5 and Spring Boot Tests

This is a maven based project so execute tests in IDE by right click project -> run as maven test will produce the following output:

Or If your IDE and it supports JUnit 5 then follow below steps to execute JUnit 5 tests.