PMT-32: Implement Tests for Responses
All checks were successful
Quality Check / Validate OAS (push) Successful in 31s
Quality Check / Linting (push) Successful in 1m5s
Quality Check / Testing (push) Successful in 1m7s
Quality Check / Static Analysis (push) Successful in 1m11s
Quality Check / Validate OAS (pull_request) Successful in 32s
Quality Check / Linting (pull_request) Successful in 1m5s
Quality Check / Testing (pull_request) Successful in 1m8s
Quality Check / Static Analysis (pull_request) Successful in 1m10s
All checks were successful
Quality Check / Validate OAS (push) Successful in 31s
Quality Check / Linting (push) Successful in 1m5s
Quality Check / Testing (push) Successful in 1m7s
Quality Check / Static Analysis (push) Successful in 1m11s
Quality Check / Validate OAS (pull_request) Successful in 32s
Quality Check / Linting (pull_request) Successful in 1m5s
Quality Check / Testing (pull_request) Successful in 1m8s
Quality Check / Static Analysis (pull_request) Successful in 1m10s
This commit is contained in:
parent
5b1a759376
commit
a61791f3ef
1 changed files with 39 additions and 0 deletions
39
src/test/java/de/hmmh/pmt/project/GetAllTest.java
Normal file
39
src/test/java/de/hmmh/pmt/project/GetAllTest.java
Normal 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())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue