Spring Web

Exercise: Todo REST Testing

  1. Clone the GitLab repository Todo.
  2. Add the Spring Boot starter spring-boot-starter-webmvc-test to the REST service.
  3. Add an SQL file data.sql that inserts some test data into the H2 database and set the application property spring.jpa.defer-datasource-initialization to true.
  4. Implement a unit test TodoMockMvcTest that only tests the REST controller and mocks the repository using a mock environment and the MockMvc
  5. Implement an integration test TodoMockMvcIT that tests the whole REST service using a mock environment and the MockMvc.
  6. Implement an integration test TodoRestClientIT that tests the whole REST service using a running server and the RestClient.

Solution