|
12 | 12 |
|
13 | 13 | import java.nio.charset.StandardCharsets; |
14 | 14 |
|
| 15 | +import static org.hamcrest.Matchers.hasItem; |
15 | 16 | import static org.hamcrest.Matchers.is; |
16 | 17 | import static org.hamcrest.Matchers.notNullValue; |
17 | 18 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; |
@@ -121,6 +122,15 @@ public void iUpdateTheProjectVisibility(String name, String visibility) throws E |
121 | 122 | .with(AuthenticationStepDefs.authenticate())) |
122 | 123 | .andDo(print()); |
123 | 124 | } |
| 125 | + |
| 126 | + @When("I retrieve the list of projects") |
| 127 | + public void iRetrieveTheListOfProjects() throws Exception { |
| 128 | + stepDefs.result = stepDefs.mockMvc.perform( |
| 129 | + get("/projects") |
| 130 | + .accept(MediaType.APPLICATION_JSON) |
| 131 | + .with(AuthenticationStepDefs.authenticate())) |
| 132 | + .andDo(print()); |
| 133 | +} |
124 | 134 |
|
125 | 135 | @When("I delete the project named {string}") |
126 | 136 | public void iDeleteTheProjectNamed(String name) throws Exception { |
@@ -160,6 +170,13 @@ public void theProjectModificationDateShouldBeSet() throws Exception { |
160 | 170 | stepDefs.result.andExpect(jsonPath("$.modified", notNullValue())); |
161 | 171 | } |
162 | 172 |
|
| 173 | + @Then("The project list contains a project named {string}") |
| 174 | + public void theProjectListContainsAProjectNamed(String name) throws Exception { |
| 175 | + stepDefs.result.andExpect( |
| 176 | + jsonPath("$._embedded.projects[*].name", hasItem(is(name))) |
| 177 | + ); |
| 178 | +} |
| 179 | + |
163 | 180 | @Then("The project visibility should be {string}") |
164 | 181 | public void theProjectVisibilityShouldBe(String visibility) throws Exception { |
165 | 182 | stepDefs.result.andExpect(jsonPath("$.visibility", is(visibility))); |
|
0 commit comments