Skip to content

Commit

Permalink
feat: 마지막 게시글 조회 테스트케이스 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
minjo-on committed Dec 9, 2024
1 parent c606f63 commit 5e5c8d0
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5e5c8d0

Please sign in to comment.