diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java b/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java index 2b7dc1eee1..79d3b972ff 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java @@ -50,7 +50,7 @@ public class CustomerController { } Link link = linkTo(methodOn(CustomerController.class).getOrdersForCustomer(customerId)).withSelfRel(); - CollectionModel result = new CollectionModel<>(orders, link); + CollectionModel result = CollectionModel.of(orders, link); return result; } @@ -72,7 +72,7 @@ public class CustomerController { } Link link = linkTo(CustomerController.class).withSelfRel(); - CollectionModel result = new CollectionModel<>(allCustomers, link); + CollectionModel result = CollectionModel.of(allCustomers, link); return result; } diff --git a/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerRequestIntegrationTest.java b/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerRequestIntegrationTest.java index a277d5a685..bb84b88bd9 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerRequestIntegrationTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerRequestIntegrationTest.java @@ -33,7 +33,7 @@ public class ExamplePostControllerRequestIntegrationTest { @Before public void preTest() { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); mockMvc = MockMvcBuilders .standaloneSetup(exampleController) .build(); diff --git a/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerResponseIntegrationTest.java b/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerResponseIntegrationTest.java index f8c70b0f4a..efc3310812 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerResponseIntegrationTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerResponseIntegrationTest.java @@ -34,7 +34,7 @@ public class ExamplePostControllerResponseIntegrationTest { @Before public void preTest() { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); mockMvc = MockMvcBuilders .standaloneSetup(exampleController) .build(); diff --git a/spring-boot-rest/src/test/java/com/baeldung/web/StudentControllerIntegrationTest.java b/spring-boot-rest/src/test/java/com/baeldung/web/StudentControllerIntegrationTest.java index 54ac69ebeb..d2d9181797 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/web/StudentControllerIntegrationTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/web/StudentControllerIntegrationTest.java @@ -8,12 +8,10 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; -import org.springframework.web.server.MediaTypeNotSupportedStatusException; import com.baeldung.web.controller.students.Student; import com.fasterxml.jackson.databind.ObjectMapper; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;