Skip to content
This repository was archived by the owner on Aug 13, 2022. It is now read-only.

#59 회원 단위테스트 추가 #124

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

#59 회원 단위테스트 추가 #124

wants to merge 1 commit into from

Conversation

0hun
Copy link
Collaborator

@0hun 0hun commented Oct 7, 2020

No description provided.

@0hun 0hun requested a review from f-lab-dev October 7, 2020 20:48
@0hun 0hun self-assigned this Oct 7, 2020
@Test
public void 비밀번호_수정() throws Exception{
//given
String encodePassword = passwordEncoder.encode(password);
Copy link
Member

Choose a reason for hiding this comment

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

passwordEncoder는 mock 객체인데 given-willReturn 처리가 안되어있네요. encoder의 동작도 정의를 해줘야합니다~

@Test
public void 회원_추가() throws Exception{
//when
accountService.addAccount(account);
Copy link
Member

Choose a reason for hiding this comment

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

여기서는 passwordEncodeCopyAccount 호출을 통해 새 객체를 insert하는것 같은데 해당 동작에 대한 커버가 되어있지 않네요. 다른 부분도 비즈니스로직에서 입력값에 대한 출력, 예외 등의 시나리오가 여러개가 있을 수 있습니다.
이런 시나리오들을 최대한 모두 정의해서 커버해주세요.

그럼 메소드명도 시나리오를 설명하는 형식으로 바뀌게 되겠죠~ (ex. 회원을 추가할때는 비밀번호를 암호화해서 insert 시킨다 등)

}

@Test
public void 회원_추가() throws Exception{
Copy link
Member

Choose a reason for hiding this comment

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

여기선 메소드명이 한글로 되어있는데 이것보다는 junit5에서 지원하는 테스트의 이름을 지을 수 있는 기능을 사용해보세요~

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

Successfully merging this pull request may close these issues.

2 participants