From 903ddb886ba8a898863b262d7a01f25faa7c4316 Mon Sep 17 00:00:00 2001 From: Olivier Levitt Date: Thu, 12 Dec 2024 17:08:12 +0100 Subject: [PATCH] Fix test --- .../insee/onyxia/api/UserControllerTest.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/onyxia-api/src/test/java/fr/insee/onyxia/api/UserControllerTest.java b/onyxia-api/src/test/java/fr/insee/onyxia/api/UserControllerTest.java index d5f90ff6..0554bded 100644 --- a/onyxia-api/src/test/java/fr/insee/onyxia/api/UserControllerTest.java +++ b/onyxia-api/src/test/java/fr/insee/onyxia/api/UserControllerTest.java @@ -1,22 +1,15 @@ package fr.insee.onyxia.api; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import com.fasterxml.jackson.databind.ObjectMapper; import fr.insee.onyxia.api.configuration.BaseTest; import fr.insee.onyxia.api.configuration.SecurityConfig; import fr.insee.onyxia.api.configuration.properties.RegionsConfiguration; import fr.insee.onyxia.api.controller.api.user.UserController; +import fr.insee.onyxia.api.services.UserProvider; import fr.insee.onyxia.api.services.utils.HttpRequestUtils; import fr.insee.onyxia.api.user.OnyxiaUserProvider; import fr.insee.onyxia.model.OnyxiaUser; import fr.insee.onyxia.model.User; -import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -26,6 +19,15 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @WebMvcTest(UserController.class) public class UserControllerTest extends BaseTest { @@ -41,6 +43,8 @@ public class UserControllerTest extends BaseTest { @MockBean private OnyxiaUserProvider onyxiaUserProvider; + @MockBean private UserProvider userProvider; + @BeforeEach public void setUp() { User user = new User();