From a1a4cf2b99da0e4fda7e88fecf3dbe11a9ac3290 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 2 Jul 2025 17:33:09 +0800 Subject: [PATCH] feat: update test cases --- src/test/java/com/openisle/controller/PostControllerTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/openisle/controller/PostControllerTest.java b/src/test/java/com/openisle/controller/PostControllerTest.java index 9c60ca329..f22575467 100644 --- a/src/test/java/com/openisle/controller/PostControllerTest.java +++ b/src/test/java/com/openisle/controller/PostControllerTest.java @@ -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());