From 5e5c8d0ba3bea4651dbe062823171b4b64c12803 Mon Sep 17 00:00:00 2001 From: minjo-on Date: Tue, 10 Dec 2024 00:50:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A7=88=EC=A7=80=EB=A7=89=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=20=EC=A1=B0=ED=9A=8C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=EC=BC=80=EC=9D=B4=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/post/application/PostServiceTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/aics-api/src/testFixtures/java/post/application/PostServiceTest.java b/aics-api/src/testFixtures/java/post/application/PostServiceTest.java index 528f0a9..b2385e8 100644 --- a/aics-api/src/testFixtures/java/post/application/PostServiceTest.java +++ b/aics-api/src/testFixtures/java/post/application/PostServiceTest.java @@ -105,6 +105,23 @@ public void getPostById_Success() { assertEquals(postId, response.postId()); assertNull(response.prevPost()); assertEquals(response.nextPost().postId(), 2L); + assertEquals(response.nextPost().postTitle(), "테스트용 제목2"); + } + + @Test + @DisplayName("getPostById는 마지막 게시글 조회 시 다음 게시글은 null이어야 한다") + public void getPostById_LastPost_Success() { + // given + Long lastPostId = 2L; + + // when + PostDetailResponse response = postService.getPostByIdWithPrevAndNext(lastPostId); + + // then + assertEquals(lastPostId, response.postId()); + assertNull(response.nextPost()); + assertEquals(response.prevPost().postId(), 1L); + assertEquals(response.prevPost().postTitle(), "테스트용 제목1"); } @Test