PMT-37: implement endpoint testing
All checks were successful
Quality Check / Validate OAS (push) Successful in 33s
Quality Check / Linting (push) Successful in 1m10s
Quality Check / Static Analysis (push) Successful in 1m17s
Quality Check / Testing (push) Successful in 1m17s
Quality Check / Validate OAS (pull_request) Successful in 32s
Quality Check / Linting (pull_request) Successful in 1m10s
Quality Check / Static Analysis (pull_request) Successful in 1m20s
Quality Check / Testing (pull_request) Successful in 1m19s
All checks were successful
Quality Check / Validate OAS (push) Successful in 33s
Quality Check / Linting (push) Successful in 1m10s
Quality Check / Static Analysis (push) Successful in 1m17s
Quality Check / Testing (push) Successful in 1m17s
Quality Check / Validate OAS (pull_request) Successful in 32s
Quality Check / Linting (pull_request) Successful in 1m10s
Quality Check / Static Analysis (pull_request) Successful in 1m20s
Quality Check / Testing (pull_request) Successful in 1m19s
This commit is contained in:
parent
3dd06fbf0c
commit
7fc105308a
1 changed files with 37 additions and 0 deletions
37
src/test/java/de/hmmh/pmt/project/GetProjectInfoTest.java
Normal file
37
src/test/java/de/hmmh/pmt/project/GetProjectInfoTest.java
Normal 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()))
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue