test: update PostService tests for new signature

This commit is contained in:
Tim
2025-08-11 10:06:53 +08:00
parent e27f57fab2
commit 36bc86da7f
2 changed files with 17 additions and 7 deletions

View File

@@ -75,7 +75,8 @@ class PostControllerTest {
post.setCategory(cat);
post.setTags(Set.of(tag));
when(postService.createPost(eq("alice"), eq(1L), eq("t"), eq("c"), eq(List.of(1L)))).thenReturn(post);
when(postService.createPost(eq("alice"), eq(1L), eq("t"), eq("c"), eq(List.of(1L)),
isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(post);
when(postService.viewPost(eq(1L), any())).thenReturn(post);
when(commentService.getCommentsForPost(eq(1L), any())).thenReturn(List.of());
when(commentService.getParticipants(anyLong(), anyInt())).thenReturn(List.of());
@@ -185,7 +186,8 @@ class PostControllerTest {
.principal(new UsernamePasswordAuthenticationToken("alice", "p")))
.andExpect(status().isBadRequest());
verify(postService, never()).createPost(any(), any(), any(), any(), any());
verify(postService, never()).createPost(any(), any(), any(), any(), any(),
any(), any(), any(), any(), any(), any());
}
@Test