Skip to content

Commit

Permalink
[DSC-1586] - Fix it tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaKr1vonosov committed Mar 22, 2024
1 parent 93a9984 commit c4978ba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,18 @@ public void findAllPaginationTest() throws Exception {
Matchers.containsString("page=1"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=18"), Matchers.containsString("size=1"))))
Matchers.containsString("page=19"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(19)))
.andExpect(jsonPath("$.page.totalPages", is(19)))
.andExpect(jsonPath("$.page.totalElements", is(20)))
.andExpect(jsonPath("$.page.totalPages", is(20)))
.andExpect(jsonPath("$.page.number", is(0)));

getClient(tokenAdmin).perform(get("/api/config/submissiondefinitions")
.param("size", "1")
.param("page", "1"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("patent")))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("funding")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=0"), Matchers.containsString("size=1"))))
Expand All @@ -347,10 +347,10 @@ public void findAllPaginationTest() throws Exception {
Matchers.containsString("page=1"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=18"), Matchers.containsString("size=1"))))
Matchers.containsString("page=19"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(19)))
.andExpect(jsonPath("$.page.totalPages", is(19)))
.andExpect(jsonPath("$.page.totalElements", is(20)))
.andExpect(jsonPath("$.page.totalPages", is(20)))
.andExpect(jsonPath("$.page.number", is(1)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public void findAll() throws Exception {
.andExpect(content().contentType(contentType))
//The configuration file for the test env includes PAGE_TOTAL_ELEMENTS forms
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(40)))
.andExpect(jsonPath("$.page.totalPages", equalTo(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(43)))
.andExpect(jsonPath("$.page.totalPages", equalTo(3)))
.andExpect(jsonPath("$.page.number", is(0)))
.andExpect(
jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL + "config/submissionforms")))
Expand All @@ -90,8 +90,8 @@ public void findAllWithNewlyCreatedAccountTest() throws Exception {
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(40)))
.andExpect(jsonPath("$.page.totalPages", equalTo(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(43)))
.andExpect(jsonPath("$.page.totalPages", equalTo(3)))
.andExpect(jsonPath("$.page.number", is(0)))
.andExpect(jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL
+ "config/submissionforms")))
Expand Down Expand Up @@ -670,19 +670,19 @@ public void findAllPaginationTest() throws Exception {
Matchers.containsString("page=1"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=19"), Matchers.containsString("size=2"))))
Matchers.containsString("page=21"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(40)))
.andExpect(jsonPath("$.page.totalPages", equalTo(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(43)))
.andExpect(jsonPath("$.page.totalPages", equalTo(22)))
.andExpect(jsonPath("$.page.number", is(0)));

getClient(tokenAdmin).perform(get("/api/config/submissionforms")
.param("size", "2")
.param("page", "15"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("publication-dc-contributor-author")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("publication-dc-contributor-editor")))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("traditionalpagethree-cris-collapsed")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("orange")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
Expand All @@ -697,10 +697,10 @@ public void findAllPaginationTest() throws Exception {
Matchers.containsString("page=16"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=19"), Matchers.containsString("size=2"))))
Matchers.containsString("page=21"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(40)))
.andExpect(jsonPath("$.page.totalPages", equalTo(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(43)))
.andExpect(jsonPath("$.page.totalPages", equalTo(22)))
.andExpect(jsonPath("$.page.number", is(15)));
}

Expand Down Expand Up @@ -744,10 +744,10 @@ public void visibilityTest() throws Exception {
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=19"), Matchers.containsString("size=2"))))
Matchers.containsString("page=21"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(40)))
.andExpect(jsonPath("$.page.totalPages", equalTo(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(43)))
.andExpect(jsonPath("$.page.totalPages", equalTo(22)))
.andExpect(jsonPath("$.page.number", is(4)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@ public void findAllTest() throws Exception {
VocabularyMatcher.matchProperties("SolrAuthorAuthority", "SolrAuthorAuthority", false, false),
VocabularyMatcher.matchProperties("SRJournalTitle", "SRJournalTitle", false, false),
VocabularyMatcher.matchProperties("common_types", "common_types", true, false),
VocabularyMatcher.matchProperties("publication-coar-types", "publication-coar-types", false, true)
VocabularyMatcher.matchProperties("publication-coar-types", "publication-coar-types", false, true),
VocabularyMatcher.matchProperties("currency", "currency", true, false)
)))
.andExpect(jsonPath("$._links.self.href",
Matchers.containsString("api/submission/vocabularies")))
.andExpect(jsonPath("$.page.totalElements", is(10)));
.andExpect(jsonPath("$.page.totalElements", is(11)));
}

@Test
Expand Down

0 comments on commit c4978ba

Please sign in to comment.