test(geschichte): add documentId, limit and status routing tests to GeschichteControllerTest
Adds list_passesDocumentIdFilterToService, list_passesLimitToService and list_passesStatusFilterToService — characterisation tests for existing parameter routing that had no controller-level coverage (refs #794). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -100,6 +100,43 @@ class GeschichteControllerTest {
|
||||
verify(geschichteService).list(any(), eq(List.of(a, b)), any(), anyInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(authorities = "READ_ALL")
|
||||
void list_passesDocumentIdFilterToService() throws Exception {
|
||||
UUID documentId = UUID.randomUUID();
|
||||
when(geschichteService.list(any(), any(), eq(documentId), anyInt()))
|
||||
.thenReturn(List.of());
|
||||
|
||||
mockMvc.perform(get("/api/geschichten").param("documentId", documentId.toString()))
|
||||
.andExpect(status().isOk());
|
||||
|
||||
verify(geschichteService).list(any(), any(), eq(documentId), anyInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(authorities = "READ_ALL")
|
||||
void list_passesLimitToService() throws Exception {
|
||||
when(geschichteService.list(any(), any(), any(), eq(5)))
|
||||
.thenReturn(List.of());
|
||||
|
||||
mockMvc.perform(get("/api/geschichten").param("limit", "5"))
|
||||
.andExpect(status().isOk());
|
||||
|
||||
verify(geschichteService).list(any(), any(), any(), eq(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(authorities = "READ_ALL")
|
||||
void list_passesStatusFilterToService() throws Exception {
|
||||
when(geschichteService.list(eq(GeschichteStatus.PUBLISHED), any(), any(), anyInt()))
|
||||
.thenReturn(List.of());
|
||||
|
||||
mockMvc.perform(get("/api/geschichten").param("status", "PUBLISHED"))
|
||||
.andExpect(status().isOk());
|
||||
|
||||
verify(geschichteService).list(eq(GeschichteStatus.PUBLISHED), any(), any(), anyInt());
|
||||
}
|
||||
|
||||
// ─── GET /api/geschichten/{id} ───────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user