PMT-32: Alle Bestehende Projekte mit ihren Informationen abrufen #7

Merged
SZUT-Ole merged 6 commits from story/PMT-32-alle-bestehende-projekte-mit into trunk 2024-10-02 08:06:44 +00:00
Showing only changes of commit a61791f3ef - Show all commits

View file

@ -0,0 +1,39 @@
package de.hmmh.pmt.project;
import de.hmmh.pmt.IntegrationTest;
import de.hmmh.pmt.db.Project;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
public class GetAllTest extends IntegrationTest {
@Test
void noProjects() throws Exception {
mvc
.perform(get(baseUri + "/project"))
.andExpect(status().isOk())
.andExpect(jsonPath("$", empty()))
;
}
@Test
void multipleProjects() throws Exception {
List<Project> allProjects = createTestProjectData();
mvc
.perform(get(baseUri + "/project"))
.andExpect(status().isOk())
.andExpect(jsonPath("$", hasSize(allProjects.size())))
.andExpect(jsonPath("$[*].id").exists())
.andExpect(jsonPath("$[*].name").exists())
;
}
}