Skip to content

Conversation

@Gyuhyeok99
Copy link
Contributor

관련 이슈

작업 내용

어학점수 관련 통합 테스트 코드 추가하였습니다.

어학점수관련통합테스트
  • GPA 점수 조회
  • 어학 점수 조회
  • GPA 등록
  • 어학 점수 등록

특이 사항

리뷰 요구사항 (선택)

@Gyuhyeok99 Gyuhyeok99 added the 테스트 Added tests label Jan 26, 2025
@Gyuhyeok99 Gyuhyeok99 self-assigned this Jan 26, 2025
@Gyuhyeok99 Gyuhyeok99 linked an issue Jan 26, 2025 that may be closed by this pull request
1 task
Copy link
Collaborator

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

가독성이~~~ 너무 좋습니다!!

image


몇가지 코멘트 달았는데, 크리티컬한건 아니라 수정 후 바로 머지하셔도 된다는 의미에서 approve 드립니다 ㅎㅎ

Comment on lines 122 to 123
// when
Long scoreId = scoreService.submitGpaScore(testUser.getEmail(), request);
Copy link
Collaborator

@nayonsoso nayonsoso Jan 27, 2025

Choose a reason for hiding this comment

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

이 부분은 Long이 아니라 long 을 쓰는게 좋겠습니다 🤔
Long 과 long 의 차이에 대해서는 크게 2가지가 있어요

  • 할당되는 메모리 크기
  • null 가능 여부

그런데 이런 지식적인 것에 나아가 제가 Long / long 을 엄격하게 구분하려고 하는 이유가 더 있는데요.
Long이 사용되면, 코드를 읽는 개발자는 '이 변수는 null 될 수도 있는거구나' 하고 생각하게 됩니다.
이런 오해를 없애기 위해서 null 되지 않을 곳에는 long을 써서 확실히 구분하면 좋겠습니다.

(사실 이 서비스코드의 리턴 타입도 long이 되어야 한다고 생각합니다.
생성에서 실패했다면 repository.save() 에서 예외가 발생할 것이니 id 를 null 로 반환할 이유는 더더욱 없을 것이라서요,
이렇게 long으로 대체해도 되는 Long이 저희 코드 곳곳에서 보여서 참.. 마음이 아픈데요..
점진적으로 잘 수정해나가봅시다!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Long이 사용되면, 코드를 읽는 개발자는 '이 변수는 null 될 수도 있는거구나' 하고 생각하게 됩니다.

이부분이 공감이 되네요! 좋은 거 같습니다! 반영했습니다. 😀

Comment on lines 127 to 133
assertAll(
() -> assertThat(savedScore.getId()).isEqualTo(scoreId),
() -> assertThat(savedScore.getGpa().getGpa()).isEqualTo(request.gpa()),
() -> assertThat(savedScore.getGpa().getGpaCriteria()).isEqualTo(request.gpaCriteria()),
() -> assertThat(savedScore.getIssueDate()).isEqualTo(request.issueDate())
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 assertAll 에도 PENDING 검증이 있으면 어떨까요?

() -> assertThat(savedScore.getVerifyStatus()).isEqualTo(VerifyStatus.PENDING)

LanguageTestScoreRequest request = createLanguageTestScoreRequest();

// when
Long scoreId = scoreService.submitLanguageTestScore(testUser.getEmail(), request);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto!

Copy link
Member

@wibaek wibaek left a comment

Choose a reason for hiding this comment

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

lgtm

3.5,
4.5,
LocalDate.now(),
"https://example.com/gpa-report.pdf"
Copy link
Member

@wibaek wibaek Jan 27, 2025

Choose a reason for hiding this comment

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

해당 부분에서 전체 url이 아닌 resource까지의 path만이 저장되고 전달되는 것으로 알고 있습니다. 실제 구현은 /gpa-report.pdf 만 전달된다는 이야기인데요, 큰 문제가 있는 것은 아니나 실제와 동일하게 테스트를 설정해 두는 게 좋을 것 같습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

좋은 거 같습니다! 반영했습니다 😀

@Gyuhyeok99 Gyuhyeok99 merged commit b37becd into main Jan 28, 2025
@Gyuhyeok99 Gyuhyeok99 deleted the test/157-add-score-integration-test branch January 30, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

테스트 Added tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: score 관련 통합테스트 코드 추가

4 participants