Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TLVB-225] 리뷰, 좋아요 레퍼지토리, 서비스, 컨트롤러 테스트 코드 작성 #78

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

dia312
Copy link
Member

@dia312 dia312 commented Feb 23, 2022

👩‍💻 요구 사항과 구현 내용

  • 리뷰, 좋아요 레퍼지토리 테스트 코드 작성
  • 리뷰, 좋아요 서비스 테스트 코드 작성
  • 리뷰, 좋아요 컨트롤러 테스트 코드 작성

✅ 피드백 반영사항

🤔 PR 포인트 & 궁금한 점

관련 이슈

TLVB-225

@dia312 dia312 self-assigned this Feb 23, 2022
@dia312
Copy link
Member Author

dia312 commented Feb 23, 2022

컨트롤러 테스트는 작업중인데 얼른 작업해서 올리겠습니다ㅏㅏㅏ!

@WithSecurityContext(factory = WithMockAuthUserSecurityContextFactory.class)
public @interface WithMockAuthUser {

long id() default 1L;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long 으로 하는게 더 좋아보이네요 :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 그러네요! 감사함니당 👍👍

event.getId());

// then
assertThat(searchedEventLike).isPresent();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래서 검증하니깐 이건 괜찮지 않을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그러네여..ㅠ 삭제해도 괜찮을 것 같숨다

Comment on lines +107 to +108
assertThat(savedReview.getDescription()).isEqualTo(review.getDescription());
assertThat(savedReview.getPictureUrl()).isEqualTo(review.getPictureUrl());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertAll()을 한번 써보면 좋을거 같네요 :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵!


@BeforeEach
void setUp() {
user = User.builder()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프로젝트가 거대해지면서 테스트에 대해서 중복코드가 굉장히 많아 지죠 :)
TestFixture라는걸 한번 적용해보면 어떠신가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 한번 적용해보겠습니다!! Fixture 클래스에 static 변수로 객체 생성해놓고 사용하면 코드가 많이 깔끔해지겠네용 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants