Skip to content

Commit

Permalink
check styles
Browse files Browse the repository at this point in the history
Signed-off-by: jamal-khey <myjamal89@gmail.com>
  • Loading branch information
jamal-khey committed Aug 5, 2024
1 parent 66fafa8 commit 571a851
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/test/java/com/powsybl/caseserver/SupervisionControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.UUID;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
Expand Down Expand Up @@ -66,9 +65,9 @@ public class SupervisionControllerTest {
@Test
public void testGetElementInfosCount() throws Exception {
createStorageDir();
importCase(TEST_CASE, true);
importCase(TEST_CASE, true);
importCase(TEST_CASE, false);
importCase(true);
importCase(true);
importCase(false);

mockMvc.perform(post("/v1/supervision/cases/reindex"))
.andExpect(status().isOk());
Expand All @@ -80,8 +79,8 @@ public void testGetElementInfosCount() throws Exception {
@Test
public void testDeleteElementInfos() throws Exception {
createStorageDir();
importCase(TEST_CASE, true);
importCase(TEST_CASE, true);
importCase(true);
importCase(true);

mockMvc.perform(delete("/v1/supervision/cases/indexation"))
.andExpect(status().isOk());
Expand All @@ -94,17 +93,17 @@ public void testDeleteElementInfos() throws Exception {
Assert.assertEquals(2, supervisionService.getIndexedCaseElementsCount());
}

private void importCase(String testCase, Boolean indexed) throws Exception {
private void importCase(Boolean indexed) throws Exception {
mockMvc.perform(multipart("/v1/cases")
.file(createMockMultipartFile(testCase))
.file(createMockMultipartFile())
.param("indexed", indexed.toString()))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString();
}

private static MockMultipartFile createMockMultipartFile(String fileName) throws IOException {
try (InputStream inputStream = CaseControllerTest.class.getResourceAsStream("/" + fileName)) {
return new MockMultipartFile("file", fileName, MediaType.TEXT_PLAIN_VALUE, inputStream);
private static MockMultipartFile createMockMultipartFile() throws IOException {
try (InputStream inputStream = CaseControllerTest.class.getResourceAsStream("/" + SupervisionControllerTest.TEST_CASE)) {
return new MockMultipartFile("file", SupervisionControllerTest.TEST_CASE, MediaType.TEXT_PLAIN_VALUE, inputStream);
}
}

Expand Down

0 comments on commit 571a851

Please sign in to comment.