added test to prove pagination bug

This commit is contained in:
Mykhaylo
2021-09-29 12:00:48 +02:00
parent c3274d1704
commit 9f237b1188

View File

@@ -288,4 +288,38 @@ public class RelationshipTypeRestRepositoryIT extends AbstractEntityIntegrationT
.andExpect(status().isBadRequest()); .andExpect(status().isBadRequest());
} }
@Test
public void findByEntityTypePublicationPaginationTest() throws Exception {
getClient().perform(get("/api/core/relationshiptypes/search/byEntityType")
.param("type", "Publication")
.param("size", "3"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.relationshiptypes", containsInAnyOrder(
RelationshipTypeMatcher.matchExplicitRestrictedRelationshipTypeValues(
"isAuthorOfPublication", "isPublicationOfAuthor"),
RelationshipTypeMatcher.matchExplicitRestrictedRelationshipTypeValues(
"isProjectOfPublication", "isPublicationOfProject"),
RelationshipTypeMatcher.matchExplicitRestrictedRelationshipTypeValues(
"isOrgUnitOfPublication", "isPublicationOfOrgUnit")
)))
.andExpect(jsonPath("$.page.number", is(0)))
.andExpect(jsonPath("$.page.totalPages", is(2)))
.andExpect(jsonPath("$.page.totalElements", is(5)));
getClient().perform(get("/api/core/relationshiptypes/search/byEntityType")
.param("type", "Publication")
.param("page", "1")
.param("size", "3"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.relationshiptypes", containsInAnyOrder(
RelationshipTypeMatcher.matchExplicitRestrictedRelationshipTypeValues(
"isAuthorOfPublication", "isPublicationOfAuthor"),
RelationshipTypeMatcher.matchExplicitRestrictedRelationshipTypeValues(
"isPublicationOfJournalIssue", "isJournalIssueOfPublication")
)))
.andExpect(jsonPath("$.page.number", is(1)))
.andExpect(jsonPath("$.page.totalPages", is(2)))
.andExpect(jsonPath("$.page.totalElements", is(5)));
}
} }