Skip to content

Commit

Permalink
refactor: 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
minjo-on committed Jan 17, 2025
1 parent 0e016b1 commit 6f144ea
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand Down Expand Up @@ -77,7 +77,7 @@ void createPost_Success() {

// when
PostPersistResponse post = postAdminFacade.createPost(postRequest);
Post found = fakePostRepository.findById(post.postId()).get();
Post found = fakePostRepository.findByIdAndDeletedAtIsNull(post.postId()).get();

// then
assertEquals("new title", found.getTitle());
Expand All @@ -95,7 +95,7 @@ void updatePost_Success() {

// when
postAdminFacade.updatePost(1L, postRequest);
Post found = fakePostRepository.findById(1L).get();
Post found = fakePostRepository.findByIdAndDeletedAtIsNull(1L).get();

// then
assertEquals("new title", found.getTitle());
Expand All @@ -122,12 +122,12 @@ void updatePost_throws_PostNotFoundException() {
@DisplayName("togglePostPinStatus는 Post의 상태를 변경한다")
void togglePostPinStatus_Success() {
// given
Post original = fakePostRepository.findById(1L).get();
Post original = fakePostRepository.findByIdAndDeletedAtIsNull(1L).get();
boolean originalBool = original.isPinned();

// when
postAdminFacade.togglePostPinStatus(1L);
Post found = fakePostRepository.findById(1L).get();
Post found = fakePostRepository.findByIdAndDeletedAtIsNull(1L).get();

// then
assertNotEquals(originalBool, found.isPinned());
Expand All @@ -140,8 +140,8 @@ void deletePost_Success() {
postAdminFacade.deletePost(1L);

// then
Post found = fakePostRepository.findById(1L).get();
assertNotNull(found.getDeletedAt());
Post result = fakePostRepository.findByIdAndDeletedAtIsNull(1L).orElse(null);
assertNull(result);
}

@Test
Expand Down

0 comments on commit 6f144ea

Please sign in to comment.