Skip to content

Commit

Permalink
Updated tests following the browsing cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Feb 27, 2024
1 parent ca5c313 commit 1895110
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,24 @@ public void findAll() throws Exception {
//We expect the content type to be "application/hal+json;charset=UTF-8"
.andExpect(content().contentType(contentType))

//Our default Discovery config has 5 browse indexes, so we expect this to be reflected in the page
//Our default Discovery config has 6 browse indexes, so we expect this to be reflected in the page
// object
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(5)))
.andExpect(jsonPath("$.page.totalElements", is(6)))
.andExpect(jsonPath("$.page.totalPages", is(1)))
.andExpect(jsonPath("$.page.number", is(0)))

//The array of browse index should have a size 5
.andExpect(jsonPath("$._embedded.browses", hasSize(5)))
//The array of browse index should have a size 6
.andExpect(jsonPath("$._embedded.browses", hasSize(6)))

//Check that all (and only) the default browse indexes are present
.andExpect(jsonPath("$._embedded.browses", containsInAnyOrder(
BrowseIndexMatcher.dateIssuedBrowseIndex("asc"),
BrowseIndexMatcher.contributorBrowseIndex("asc"),
BrowseIndexMatcher.titleBrowseIndex("asc"),
BrowseIndexMatcher.subjectBrowseIndex("asc"),
BrowseIndexMatcher.hierarchicalBrowseIndex("srsc")
BrowseIndexMatcher.hierarchicalBrowseIndex("srsc"),
BrowseIndexMatcher.languageBrowseIndex("asc")
)))
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public static Matcher<? super Object> publisherBrowseIndex(final String order) {

public static Matcher<? super Object> languageBrowseIndex(final String order) {
return allOf(
hasJsonPath("$.metadata", contains("dc.language.iso")),
hasJsonPath("$.metadataBrowse", Matchers.is(true)),
hasJsonPath("$.dataType", equalToIgnoringCase("iso_lang")),
hasJsonPath("$.metadata", contains("local.language.name")),
hasJsonPath("$.browseType", equalToIgnoringCase(BROWSE_TYPE_VALUE_LIST)),
hasJsonPath("$.dataType", equalToIgnoringCase("text")),
hasJsonPath("$.order", equalToIgnoringCase(order)),
hasJsonPath("$.sortOptions[*].name", containsInAnyOrder("title", "dateissued", "dateaccessioned")),
hasJsonPath("$._links.self.href", is(REST_SERVER_URL + "discover/browses/language")),
Expand Down

0 comments on commit 1895110

Please sign in to comment.