PMT-37: Alle informationen eines bestimmten Projektes abrufen #19

Merged
SZUT-Ole merged 3 commits from story/PMT-37-alles-informationen-eines into trunk 2024-10-24 08:00:52 +00:00
Showing only changes of commit 7fc105308a - Show all commits

View file

@ -0,0 +1,37 @@
package de.hmmh.pmt.project;
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;
import java.util.Map;
import org.junit.jupiter.api.Test;
import de.hmmh.pmt.IntegrationTest;
import de.hmmh.pmt.db.Project;
public class GetProjectInfoTest extends IntegrationTest {
@Test
void noProject() throws Exception {
mvc
.perform(get(baseUri + "/project/1"))
.andExpect(status().isNotFound());
}
@Test
void getProjectInfo() throws Exception {
Map<String, Project> allProjects = createTestProjectData();
Project spaceStation = allProjects.get("space-station");
mvc
.perform(get(baseUri + "/project/" +spaceStation.getId()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(spaceStation.getId()))
.andExpect(jsonPath("$.name").value(spaceStation.getName()))
.andExpect(jsonPath("$.goal").value(spaceStation.getGoal()))
.andExpect(jsonPath("$.customerId").value(spaceStation.getCustomerId()))
.andExpect(jsonPath("$.administratorId").value(spaceStation.getAdministratorId()))
;
}
}