Apply Spring Boot @WebMvcTest for Rest Controller Unit Test with JUnit 5 and Mockito.
For more detail, please visit:
The code gives you an additional unit test for following Rest APIs example:
More Practice:
-
Spring Boot Pagination & Filter example | Spring JPA, Pageable
-
Spring Data JPA Sort/Order by multiple Columns | Spring Boot
-
Cache the result: Spring Boot Redis Cache example
-
Documentation: Spring Boot with Swagger 3 example
-
Reactive Rest API: Spring Boot WebFlux example
Exception Handling:
Associations:
Security:
Deployment:
Fullstack:
mvn test -Dtest=TutorialControllerTests