feat: update test cases

This commit is contained in:
tim
2025-07-02 17:33:09 +08:00
parent d3ce98a6de
commit a1a4cf2b99

View File

@@ -70,7 +70,7 @@ class PostControllerTest {
post.setCategory(cat);
post.setTags(java.util.Set.of(tag));
Mockito.when(postService.createPost(eq("alice"), eq(1L), eq("t"), eq("c"), eq(java.util.List.of(1L)))).thenReturn(post);
Mockito.when(postService.getPost(1L)).thenReturn(post);
Mockito.when(postService.viewPost(1L, "alice")).thenReturn(post);
mockMvc.perform(post("/api/posts")
.contentType("application/json")
@@ -174,7 +174,7 @@ class PostControllerTest {
cr.setComment(comment);
cr.setType(com.openisle.model.ReactionType.LIKE);
Mockito.when(postService.getPost(1L)).thenReturn(post);
Mockito.when(postService.viewPost(1L, user.getUsername())).thenReturn(post);
Mockito.when(commentService.getCommentsForPost(1L)).thenReturn(List.of(comment));
Mockito.when(commentService.getReplies(2L)).thenReturn(List.of(reply));
Mockito.when(commentService.getReplies(3L)).thenReturn(List.of());