The reference currently uses JUnit 4 in testing examples -- for example, Setting Up MockMvc and Spring Security.

Consider updating testing examples to use JUnit Jupiter in line with Spring Boot and other Spring portfolio projects.

Comment From: nor-ek

I can take this task. But I've got some questions. Should we still use @RunWith or replace by @ExtendsWith? If We are going to use @RunWith then we need to use SpringRunner and task should be done. Another question is about @SpringBootTest, what do you think about using it? Then rest of annotations are unnecessary.

Comment From: sbrannen

Should we still use @RunWith or replace by @ExtendsWith? If We are going to use @RunWith then we need to use SpringRunner and task should be done.

No. @RunWith is JUnit 4, and the SpringRunner is Spring's integration with JUnit 4.

Another question is about @SpringBootTest, what do you think about using it? Then rest of annotations are unnecessary.

Correct, @SpringBootTest is meta-annotated with @ExtendWith(SpringExtension.class). So I would suggest that example test classes are either annotated with @ExtendWith(SpringExtension.class) or @SpringBootTest, but I'll let the Spring Security team decide which they prefer.

Comment From: sjohnr

Thanks @sbrannen.

Another question is about @SpringBootTest, what do you think about using it? Then rest of annotations are unnecessary.

Correct, @SpringBootTest is meta-annotated with @ExtendWith(SpringExtension.class). So I would suggest that example test classes are either annotated with @ExtendWith(SpringExtension.class) or @SpringBootTest, but I'll let the Spring Security team decide which they prefer.

I don't believe we would want to use @SpringBootTest in Spring Security. For documentation, I suppose it could be less strict, but unless there is already a precedent, perhaps we don't want to introduce that now.

Thanks for volunteering, @nor-ek!