spring-boot-unit-test-rest-controller icon indicating copy to clipboard operation
spring-boot-unit-test-rest-controller copied to clipboard

Spring Boot Rest API unit test with Junit 5, Mockito, Maven

Spring Boot Rest API unit testing with Junit 5, Mockito, Maven

Apply Spring Boot @WebMvcTest for Rest Controller Unit Test with JUnit 5 and Mockito.

For more detail, please visit:

Spring Boot Rest Controller Unit Test with @WebMvcTest

Spring Boot Unit Test for JPA Repository example

The code gives you an additional unit test for following Rest APIs example:

Spring Boot + H2

Spring Boot + MySQL

Spring Boot + PostgreSQL

Spring Data + MongoDB

Spring JPA + SQL Server

Spring JPA + Oracle

Spring Data + Cassandra

More Practice:

Spring Boot Validate Request Body

Spring JPA @Query example: Custom query in Spring Boot

Spring JPA Native Query example in Spring Boot

Spring Boot File upload example with Multipart File

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:

Spring Boot @ControllerAdvice & @ExceptionHandler example

@RestControllerAdvice example in Spring Boot

Associations:

Spring Boot One To One example with Spring JPA, Hibernate

Spring Boot One To Many example with Spring JPA, Hibernate

Spring Boot Many To Many example with Spring JPA, Hibernate

Security:

Spring Boot + Spring Security JWT Authentication & Authorization

Deployment:

Deploy Spring Boot App on AWS – Elastic Beanstalk

Docker Compose Spring Boot and MySQL example

Fullstack:

Integrate Angular with Spring Boot Rest API

Integrate React with Spring Boot Rest API

Integrate Vue with Spring Boot Rest API

Run Spring Boot application

mvn test -Dtest=TutorialControllerTests