spring-mvc-rest-mockito
spring-mvc-rest-mockito copied to clipboard
Sample Spring-MVC, REST, Mockito project
RESTful Services with SpringMVC (tested with Mockito)
Sample project that covers the following concepts:
- Spring-MVC
- REST responses on Spring Controllers
- Testing for REST endpoints using Mockito
REST Endpoints
We try to follow well-accepted REST principles with these examples. All operations performed on this user entity are through the same endpoint and use the request method as a determiner for the service to call...
- Retrieve user with ID=3:
GET http://localhost:8080/user/3 - Save a new User:
POST http://localhost:8080/user - Update User:
PUT http://localhost:8080/user - Delete use with ID=3:
DELETE http://localhost:8080/user/3
If an endpoint is triggered that does not have a mapping, the DefaultController will respond with an error.
Usage
- Clone the repository
- To run the tests:
mvn clean test - If deploying to a servlet container:
http://localhost:8080/userwill return an initial response.
See org.royrusso.mvc.controller.UserController for more REST endpoints.