Skip to content

Commit

Permalink
refactor: (#95) PostServiceTest의 코드에서 finded 단어를 found로 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdtls690 committed Jul 30, 2023
1 parent 21d10f3 commit 34e5aa7
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,16 @@ void postClosedEarlyById() throws InterruptedException {
.build()
);

Post findedPost = postRepository.findById(post.getId()).get();
Post foundPost = postRepository.findById(post.getId()).get();
Thread.sleep(50);

// when
postService.postClosedEarlyById(post.getId(), writer);

// then
assertAll(
() -> assertThat(findedPost.getId()).isEqualTo(post.getId()),
() -> assertThat(findedPost.getDeadline()).isBefore(oldDeadline)
() -> assertThat(foundPost.getId()).isEqualTo(post.getId()),
() -> assertThat(foundPost.getDeadline()).isBefore(oldDeadline)
);
}

Expand All @@ -369,10 +369,10 @@ void throwExceptionNotWriterPostClosedEarly() {
.build()
);

Post findedPost = postRepository.findById(post.getId()).get();
Post foundPost = postRepository.findById(post.getId()).get();

// when, then
assertThatThrownBy(() -> postService.postClosedEarlyById(findedPost.getId(), MemberFixtures.MALE_30.get()))
assertThatThrownBy(() -> postService.postClosedEarlyById(foundPost.getId(), MemberFixtures.MALE_30.get()))
.isInstanceOf(BadRequestException.class)
.hasMessage("해당 게시글 작성자가 아닙니다.");
}
Expand All @@ -391,10 +391,10 @@ void throwExceptionDeadLinePostClosedEarly() {
.build()
);

Post findedPost = postRepository.findById(post.getId()).get();
Post foundPost = postRepository.findById(post.getId()).get();

// when, then
assertThatThrownBy(() -> postService.postClosedEarlyById(findedPost.getId(), writer))
assertThatThrownBy(() -> postService.postClosedEarlyById(foundPost.getId(), writer))
.isInstanceOf(BadRequestException.class)
.hasMessage("게시글이 이미 마감되었습니다.");
}
Expand All @@ -413,10 +413,10 @@ void throwExceptionHalfDeadLinePostClosedEarly() {
.build()
);

Post findedPost = postRepository.findById(post.getId()).get();
Post foundPost = postRepository.findById(post.getId()).get();

// when, then
assertThatThrownBy(() -> postService.postClosedEarlyById(findedPost.getId(), writer))
assertThatThrownBy(() -> postService.postClosedEarlyById(foundPost.getId(), writer))
.isInstanceOf(BadRequestException.class)
.hasMessage("게시글이 마감 시간까지 절반의 시간 이상이 지나지 않으면 조기마감을 할 수 없습니다.");
}
Expand Down

0 comments on commit 34e5aa7

Please sign in to comment.