Skip to content
Snippets Groups Projects
Commit 37eb812b authored by OZGCloud's avatar OZGCloud
Browse files

OZG-530 fix FileController

parent ec3c4ffa
Branches
Tags
No related merge requests found
......@@ -3,9 +3,11 @@ package de.itvsh.goofy.file;
import org.springframework.hateoas.EntityModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController(FileController.FILE_PATH)
@RestController
@RequestMapping(FileController.FILE_PATH)
public class FileController {
static final String FILE_PATH = "/api/files"; // NOSONAR
......
package de.itvsh.goofy.file;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
class FileControllerTest {
private final String PATH = FileController.FILE_PATH + "/";
@InjectMocks
private FileController controller;
@Mock
private FileModelAssembler modelAssembler;
@Mock
private FileService fileService;
private MockMvc mockMvc;
@BeforeEach
void init() {
mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
}
@Nested
class TestGetFileData {
@Test
void shouldCallEndpoint() throws Exception {
callEndpoint();
}
private void callEndpoint() throws Exception {
mockMvc.perform(get(PATH + "1")).andExpect(status().isOk());
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment