mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
DS-3230 Browse by author broken if author name has special character - add tests
This commit is contained in:
@@ -13,6 +13,7 @@ import static org.hamcrest.Matchers.contains;
|
|||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||||
|
import static org.hamcrest.Matchers.hasItem;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
@@ -1140,6 +1141,58 @@ public class DiscoveryRestControllerIT extends AbstractControllerIntegrationTest
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void discoverSearchObjectsWithSpecialCharacterTest() throws Exception {
|
||||||
|
|
||||||
|
context.turnOffAuthorisationSystem();
|
||||||
|
|
||||||
|
parentCommunity = CommunityBuilder.createCommunity(context).build();
|
||||||
|
Collection collection = CollectionBuilder.createCollection(context, parentCommunity).build();
|
||||||
|
ItemBuilder.createItem(context, collection)
|
||||||
|
.withAuthor("Atmire & friends")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
context.restoreAuthSystemState();
|
||||||
|
|
||||||
|
getClient().perform(
|
||||||
|
get("/api/discover/search/objects")
|
||||||
|
.param("sort", "score,DESC")
|
||||||
|
.param("page", "0")
|
||||||
|
.param("size", "10"))
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(jsonPath("$._embedded.facets", hasItem(allOf(
|
||||||
|
hasJsonPath("$.name", is("author")),
|
||||||
|
hasJsonPath("$._embedded.values", hasItem(
|
||||||
|
hasJsonPath("$._links.search.href", containsString("Atmire%20%26%20friends"))
|
||||||
|
))
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void discoverSearchBrowsesWithSpecialCharacterTest() throws Exception {
|
||||||
|
|
||||||
|
context.turnOffAuthorisationSystem();
|
||||||
|
|
||||||
|
parentCommunity = CommunityBuilder.createCommunity(context).build();
|
||||||
|
Collection collection = CollectionBuilder.createCollection(context, parentCommunity).build();
|
||||||
|
ItemBuilder.createItem(context, collection)
|
||||||
|
.withAuthor("Atmire & friends")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
context.restoreAuthSystemState();
|
||||||
|
|
||||||
|
getClient().perform(
|
||||||
|
get("/api/discover/browses/author/entries")
|
||||||
|
.param("sort", "default,ASC")
|
||||||
|
.param("page", "0")
|
||||||
|
.param("size", "20"))
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(jsonPath("$._embedded.entries", hasItem(allOf(
|
||||||
|
hasJsonPath("$.value", is("Atmire & friends")),
|
||||||
|
hasJsonPath("$._links.items.href", containsString("Atmire%20%26%20friends"))
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void discoverSearchObjectsTestHasMoreAuthorFacet() throws Exception {
|
public void discoverSearchObjectsTestHasMoreAuthorFacet() throws Exception {
|
||||||
//We turn off the authorization system in order to create the structure defined below
|
//We turn off the authorization system in order to create the structure defined below
|
||||||
|
Reference in New Issue
Block a user