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

Feat: 학과 리스트 반환 api 작성 #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

coke98
Copy link
Contributor

@coke98 coke98 commented Jul 12, 2022

What is the PR?

Resolve #10

Changes

  • major.java 디렉토리 변경(member -> major)

Test Check List

  • repository, controller 단위 테스트 작성
  • service의 경우 단순 findAll 반환이기에 생략

etc

 - controller, repository 단위 테스트 작성
 - major.java 디렉토리 변경(member -> major)
Resolves: GDSC-PKNU-Official#10
@coke98 coke98 added the enhancement New feature or request label Jul 12, 2022
@coke98 coke98 self-assigned this Jul 12, 2022
Copy link
Member

@Cha-Ji Cha-Ji left a comment

Choose a reason for hiding this comment

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

커밋을 더 쪼개면 어떤지 지금과의 차이로 장단점을 비교해보면 좋을 것 같아요.
쪼갰을 때 장점 몇가지만 얘기해볼게요.

  1. 커밋 메세지만 읽고 어떤 흐름으로 개발했는지 볼 수 있습니다.
  2. 커밋 메세지 한줄만으로 어떤 작업을 했는지 유추하기 쉽습니다.
  3. 너무 쪼개서 중복된 메세지의 커밋이 나오더라도 squash할 수 있습니다.
  4. github의 code 탭에서 이 코드를 변경한 커밋이 어떤 커밋인지 history를 볼 수 있습니다.
  5. 불필요한 커밋이 생겨 되돌려야 할 때 다른 코드에 영향없이 revert할 수 있습니다.

import org.springframework.data.jpa.repository.JpaRepository;

public interface MajorRepository extends JpaRepository<Major, Long> {
List<Major> findAll();
Copy link
Member

Choose a reason for hiding this comment

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

findAll() 메서드에서 find라는 이름을 보니 nullable한 반환값이 예상되네요.
부모클래스의 메서드를 그대로 오버라이드 한건가요?
그런게 아니라면 반환형을 Optional로 사용하거나, 메서드 이름을 get으로 치환하는건 어떨까요?

Comment on lines +25 to +26
assert(majors.size() == 79);
assert(majors.get(78).getMajorName().equals("공공안전경찰학과"));
Copy link
Member

Choose a reason for hiding this comment

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

단언하는 메서드는 assert, assertEquals, assertTrue, assertThat 등 여러가지가 있는데, 다같이 한가지로 통일해봐도 좋을 것 같아요. 그 외에도 hamcrest 등으로 가독성을 높일 수 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

학과 리스트 불러오기 테스트 코드 작성
2 participants