verify return structure of empty repos

This commit is contained in:
Terry W Brady
2018-05-15 12:02:38 -07:00
parent d4df6d12c6
commit 141be6e338

View File

@@ -0,0 +1,42 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.rest;
import static org.hamcrest.Matchers.is;
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 org.dspace.app.rest.test.AbstractControllerIntegrationTest;
import org.junit.Test;
public class EmptyRestRepositoryIT extends AbstractControllerIntegrationTest {
@Test
public void findAllTest() throws Exception {
//Test retrieval of all communities while none exist
getClient().perform(get("/api/core/communities"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.page.totalElements", is(0)));
//Test retrieval of all collections while none exist
getClient().perform(get("/api/core/collections"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.page.totalElements", is(0)));
//Test retrieval of all items while none exist
getClient().perform(get("/api/core/items"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.page.totalElements", is(0)));
//Test retrieval of all bitstreams while none exist
getClient().perform(get("/api/core/bitstreams"))
. andExpect(status().isOk())
.andExpect(jsonPath("$.page.totalElements", is(0)));
}
}