mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 13:03:11 +00:00
Additional pagination tests
This commit is contained in:
@@ -55,7 +55,6 @@ public class EntityTypeRestRepositoryIT extends AbstractEntityIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllEntityTypeEndpointWithPaging() throws Exception {
|
public void getAllEntityTypeEndpointWithPaging() throws Exception {
|
||||||
//When we call this facets endpoint
|
|
||||||
getClient().perform(get("/api/core/entitytypes").param("size", "5"))
|
getClient().perform(get("/api/core/entitytypes").param("size", "5"))
|
||||||
|
|
||||||
//We expect a 200 OK status
|
//We expect a 200 OK status
|
||||||
@@ -75,6 +74,25 @@ public class EntityTypeRestRepositoryIT extends AbstractEntityIntegrationTest {
|
|||||||
EntityTypeMatcher.matchEntityTypeEntry(entityTypeService.findByEntityType(context, "OrgUnit")),
|
EntityTypeMatcher.matchEntityTypeEntry(entityTypeService.findByEntityType(context, "OrgUnit")),
|
||||||
EntityTypeMatcher.matchEntityTypeEntry(entityTypeService.findByEntityType(context, "Journal"))
|
EntityTypeMatcher.matchEntityTypeEntry(entityTypeService.findByEntityType(context, "Journal"))
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
getClient().perform(get("/api/core/entitytypes").param("size", "5").param("page", "1"))
|
||||||
|
|
||||||
|
//We expect a 200 OK status
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
//The type has to be 'discover'
|
||||||
|
.andExpect(jsonPath("$.page.size", is(5)))
|
||||||
|
.andExpect(jsonPath("$.page.totalElements", is(7)))
|
||||||
|
.andExpect(jsonPath("$.page.totalPages", is(2)))
|
||||||
|
.andExpect(jsonPath("$.page.number", is(1)))
|
||||||
|
//There needs to be a self link to this endpoint
|
||||||
|
.andExpect(jsonPath("$._links.self.href", containsString("api/core/entitytypes")))
|
||||||
|
//We have 4 facets in the default configuration, they need to all be present in the embedded section
|
||||||
|
.andExpect(jsonPath("$._embedded.entitytypes", containsInAnyOrder(
|
||||||
|
EntityTypeMatcher
|
||||||
|
.matchEntityTypeEntry(entityTypeService.findByEntityType(context, "JournalVolume")),
|
||||||
|
EntityTypeMatcher
|
||||||
|
.matchEntityTypeEntry(entityTypeService.findByEntityType(context, "JournalIssue"))
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.app.rest;
|
package org.dspace.app.rest;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.contains;
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -173,6 +174,15 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
|
|||||||
)))
|
)))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
getClient().perform(get("/api/core/relationships").param("size", "2").param("page", "1"))
|
||||||
|
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(jsonPath("$.page",
|
||||||
|
is(PageMatcher.pageEntryWithTotalPagesAndElements(1, 2, 2, 3))))
|
||||||
|
.andExpect(jsonPath("$._embedded.relationships", contains(
|
||||||
|
RelationshipMatcher.matchRelationship(relationship3)
|
||||||
|
)))
|
||||||
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user