diff --git a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.java b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.java index d487f16dd..5389873a2 100644 --- a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.java +++ b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.java @@ -9,7 +9,6 @@ import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; diff --git a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.java b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.java index 01cd4562b..9bf13c371 100644 --- a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.java +++ b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.java @@ -1,35 +1,19 @@ package de.caritas.cob.userservice.api.adapters.web.controller; -import static de.caritas.cob.userservice.api.adapters.web.controller.UserAdminControllerIT.ADMIN_DATA_PATH; import static de.caritas.cob.userservice.api.adapters.web.controller.UserAdminControllerIT.AGENCY_ADMIN_PATH; -import static de.caritas.cob.userservice.api.adapters.web.controller.UserAdminControllerIT.CONSULTANT_PATH; -import static de.caritas.cob.userservice.api.adapters.web.controller.UserAdminControllerIT.TENANT_ADMIN_PATH; -import static de.caritas.cob.userservice.api.adapters.web.controller.UserAdminControllerIT.TENANT_ADMIN_PATH_WITHOUT_SLASH; -import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; import de.caritas.cob.userservice.api.adapters.keycloak.dto.KeycloakCreateUserResponseDTO; -import de.caritas.cob.userservice.api.adapters.rocketchat.RocketChatCredentialsProvider; import de.caritas.cob.userservice.api.adapters.web.dto.CreateAdminDTO; -import de.caritas.cob.userservice.api.adapters.web.dto.CreateConsultantDTO; -import de.caritas.cob.userservice.api.adapters.web.dto.PatchAdminDTO; -import de.caritas.cob.userservice.api.adapters.web.dto.UpdateAgencyAdminDTO; -import de.caritas.cob.userservice.api.adapters.web.dto.UpdateTenantAdminDTO; import de.caritas.cob.userservice.api.admin.service.tenant.TenantService; import de.caritas.cob.userservice.api.config.apiclient.AgencyServiceApiControllerFactory; import de.caritas.cob.userservice.api.config.apiclient.ConsultingTypeServiceApiControllerFactory; @@ -37,24 +21,17 @@ import de.caritas.cob.userservice.api.config.auth.Authority.AuthorityValue; import de.caritas.cob.userservice.api.config.auth.IdentityConfig; import de.caritas.cob.userservice.api.helper.AuthenticatedUser; -import de.caritas.cob.userservice.api.model.Admin.AdminType; -import de.caritas.cob.userservice.api.model.User; -import de.caritas.cob.userservice.api.port.out.AdminRepository; import de.caritas.cob.userservice.api.port.out.IdentityClient; import de.caritas.cob.userservice.api.tenant.TenantResolverService; import de.caritas.cob.userservice.api.testConfig.TestAgencyControllerApi; import de.caritas.cob.userservice.consultingtypeservice.generated.web.ConsultingTypeControllerApi; import de.caritas.cob.userservice.mailservice.generated.web.MailsControllerApi; import de.caritas.cob.userservice.tenantservice.generated.web.model.RestrictedTenantDTO; -import de.caritas.cob.userservice.topicservice.generated.web.TopicControllerApi; -import java.util.LinkedHashMap; import javax.servlet.http.Cookie; -import net.minidev.json.JSONArray; import org.jeasy.random.EasyRandom; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.keycloak.admin.client.Keycloak; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -69,7 +46,6 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.client.RestTemplate; @SpringBootTest @AutoConfigureMockMvc @@ -107,11 +83,9 @@ class UserAdminControllerMultiTenancyTrueE2EIT { @MockBean TenantService tenantService; - @MockBean - TenantResolverService tenantResolverService; + @MockBean TenantResolverService tenantResolverService; - @MockBean - AuthenticatedUser authenticatedUser; + @MockBean AuthenticatedUser authenticatedUser; @AfterEach void reset() { @@ -169,8 +143,7 @@ void createNewAgencyAdmin_Should_returnOk_When_requiredCreateAgencyAdminIsGiven( @Test @WithMockUser(authorities = {AuthorityValue.USER_ADMIN}) - void createNewAgencyAdmin_Should_return500_When_superAdminHasNullTenantID() - throws Exception { + void createNewAgencyAdmin_Should_return500_When_superAdminHasNullTenantID() throws Exception { // given CreateAdminDTO createAdminDTO = new EasyRandom().nextObject(CreateAdminDTO.class); createAdminDTO.setEmail("agencyadmin@email.com"); @@ -197,38 +170,7 @@ private void givenTenantSuperAdmin() { private void givenTenant() { when(tenantResolverService.resolve(any())).thenReturn(95L); - when(tenantService.getRestrictedTenantData(anyLong())).thenReturn(new RestrictedTenantDTO().subdomain("subdomain")); + when(tenantService.getRestrictedTenantData(anyLong())) + .thenReturn(new RestrictedTenantDTO().subdomain("subdomain")); } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java b/src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java index 0b9c11d74..33706127e 100644 --- a/src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java +++ b/src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java @@ -171,7 +171,7 @@ public void afterTests() { @Test public void - createNewAdminAgency_Should_returnExpectedCreatedAdmin_When_userIsSuperAdminAndInputDataIsCorrectAndMultitenancyDisabled() { + createNewAdminAgency_Should_returnExpectedCreatedAdmin_When_userIsSuperAdminAndInputDataIsCorrectAndMultitenancyDisabled() { // given ReflectionTestUtils.setField(createAdminService, "multiTenancyEnabled", false); TenantContext.setCurrentTenant(0L);