Skip to content

Commit

Permalink
Fix TU suite à modif sur pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-maraval committed May 6, 2024
1 parent 710f0b0 commit b7b94ed
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void init() {
@Test
@WithMockUser(authorities = {"ADMIN"})
void testGetAllActiveDemandes() throws Exception {
Mockito.when(demandeExempService.getAllActiveDemandesForAdminExtended(page, size)).thenReturn(this.demandeExemps);
Mockito.when(demandeExempService.getAllActiveDemandesForAdminExtended(page-1, size)).thenReturn(this.demandeExemps);
this.mockMvc.perform(get("/api/v1/demandes?type=EXEMP&extension=true&page=1&size=10").requestAttr("iln", "1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].id").value("1"))
Expand All @@ -94,7 +94,7 @@ void testGetAllActiveDemandes() throws Exception {
.andExpect(jsonPath("$[1].typeExemp").value("Monographies"));


Mockito.when(demandeExempService.getAllActiveDemandesForAdmin("1", page, size)).thenReturn(this.demandeExemps);
Mockito.when(demandeExempService.getAllActiveDemandesForAdmin("1", page-1, size)).thenReturn(this.demandeExemps);
this.mockMvc.perform(get("/api/v1/demandes?type=EXEMP&extension=false&page=1&size=10").requestAttr("iln", "1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].id").value("1"))
Expand All @@ -106,7 +106,7 @@ void testGetAllActiveDemandes() throws Exception {
@Test
@WithMockUser(authorities = {"USER"})
void testChercher() throws Exception {
Mockito.when(demandeExempService.getActiveDemandesForUser("1", page, size)).thenReturn(this.demandeExemps);
Mockito.when(demandeExempService.getActiveDemandesForUser("1", page-1, size)).thenReturn(this.demandeExemps);
this.mockMvc.perform(get("/api/v1/chercherDemandes?type=EXEMP&extension=true&page=1&size=10").requestAttr("iln", "1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].id").value("1"))
Expand All @@ -118,15 +118,15 @@ void testChercher() throws Exception {
@Test
@WithMockUser(authorities = {"USER"})
void testGetAllArchivedDemandes() throws Exception {
Mockito.when(demandeExempService.getAllArchivedDemandesAllIln(page, size)).thenReturn(this.demandeExemps);
Mockito.when(demandeExempService.getAllArchivedDemandesAllIln(page-1, size)).thenReturn(this.demandeExemps);
this.mockMvc.perform(get("/api/v1/chercherArchives?type=EXEMP&extension=true&page=1&size=10").requestAttr("iln", "1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].id").value("1"))
.andExpect(jsonPath("$[0].rcr").value("111111111"))
.andExpect(jsonPath("$[1].id").value("2"))
.andExpect(jsonPath("$[1].rcr").value("222222222"));

Mockito.when(demandeExempService.getAllArchivedDemandes("1", page, size)).thenReturn(this.demandeExemps);
Mockito.when(demandeExempService.getAllArchivedDemandes("1", page-1, size)).thenReturn(this.demandeExemps);
this.mockMvc.perform(get("/api/v1/chercherArchives?type=EXEMP&extension=false&page=1&size=10").requestAttr("iln", "1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].id").value("1"))
Expand Down

0 comments on commit b7b94ed

Please sign in to comment.