diff --git a/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerFeatureDisabledIT.java b/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerFeatureDisabledIT.java index a7b11eaa..d180090d 100644 --- a/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerFeatureDisabledIT.java +++ b/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerFeatureDisabledIT.java @@ -19,20 +19,21 @@ """) public class ManagerControllerFeatureDisabledIT extends IntegrationTest { + private static final String MANAGER_PATH = "/manager"; + @Autowired public MockMvc mockMvc; - private static final String PATH = "/manager/execute/query"; @Autowired private ObjectMapper mapper; @Test @SneakyThrows @WithMockNumUser(roles = {"MANAGER"}) - public void execute() { + public void executeQuery() { QueryDto queryDto = new QueryDto(); - mockMvc.perform(post(PATH).with(csrf()) + mockMvc.perform(post(MANAGER_PATH + "/execute/query").with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(mapper.writeValueAsString(queryDto)) ).andExpect(status().isNotFound()); @@ -41,10 +42,10 @@ public void execute() { @Test @SneakyThrows @WithMockNumUser() - public void executeAsNonAuthorizedUser() { + public void executeQueryAsNonAuthorizedUser() { QueryDto queryDto = new QueryDto(); - mockMvc.perform(post(PATH).with(csrf()) + mockMvc.perform(post(MANAGER_PATH + "/execute/query").with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(mapper.writeValueAsString(queryDto)) ).andExpect(status().isNotFound()); diff --git a/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerIT.java b/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerIT.java index 0d945efb..5073e9fd 100644 --- a/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerIT.java +++ b/src/test/java/org/highmed/numportal/integrationtesting/tests/ManagerControllerIT.java @@ -48,7 +48,7 @@ public void executeQuery() { var expectedResult = mapper.writeValueAsString(queryResponseData); ehrClient - .when(HttpRequest.request().withMethod("POST").withHeaders(AUTH_HEADER).withPath("/ehrbase/rest/openehr/v1/query/aql/").withBody(StringBody.subString(query, StandardCharsets.UTF_8))) + .when(HttpRequest.request().withMethod("POST").withPath("/ehrbase/rest/openehr/v1/query/aql/").withBody(StringBody.subString(query, StandardCharsets.UTF_8))) .respond(HttpResponse.response().withStatusCode(HttpStatusCode.OK_200.code()).withBody(expectedResult, org.mockserver.model.MediaType.JSON_UTF_8)); MvcResult result = diff --git a/src/test/java/org/highmed/numportal/integrationtesting/tests/ProjectControllerIT.java b/src/test/java/org/highmed/numportal/integrationtesting/tests/ProjectControllerIT.java index dd7aa785..afc08ee6 100644 --- a/src/test/java/org/highmed/numportal/integrationtesting/tests/ProjectControllerIT.java +++ b/src/test/java/org/highmed/numportal/integrationtesting/tests/ProjectControllerIT.java @@ -27,9 +27,6 @@ import org.highmed.numportal.domain.repository.OrganizationRepository; import org.highmed.numportal.domain.repository.ProjectRepository; import org.highmed.numportal.domain.repository.UserDetailsRepository; -import org.highmed.numportal.service.ProjectService; -import org.highmed.numportal.service.util.ExportHeaderUtil; -import org.highmed.numportal.service.util.ExportUtil; import java.time.LocalDate; import java.util.List; @@ -56,8 +53,7 @@ public class ProjectControllerIT extends IntegrationTest { .registerModule(new PageJacksonModule()) .registerModule(new SortJacksonModule()) .registerModule(new JavaTimeModule()); - @Autowired private ExportUtil exportUtil; - @Autowired private ExportHeaderUtil exportHeaderUtil; + @Autowired private ProjectRepository projectRepository; @Autowired private UserDetailsRepository userDetailsRepository; @Autowired diff --git a/src/test/java/org/highmed/numportal/service/ProjectServiceTest.java b/src/test/java/org/highmed/numportal/service/ProjectServiceTest.java index 8ad95d15..89a91ae4 100644 --- a/src/test/java/org/highmed/numportal/service/ProjectServiceTest.java +++ b/src/test/java/org/highmed/numportal/service/ProjectServiceTest.java @@ -37,7 +37,6 @@ import org.highmed.numportal.service.util.ExportHeaderUtil; import org.highmed.numportal.service.util.ExportUtil; -import org.ehrbase.openehr.sdk.response.dto.QueryResponseData; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; @@ -51,13 +50,9 @@ import org.springframework.mock.web.MockMultipartFile; import org.springframework.util.MultiValueMap; import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; import java.io.IOException; -import java.time.LocalDateTime; import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern;