-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: 환불하는데 돈이 오히려 차감되던 버그 수정과 시니어 등록, 수정 시 폰 번호 중복 확인 로직 추가 (#166)
* fix: 환불하는데 돈이 오히려 차감되던 버그 수정 * feat: 시니어 등록, 수정 시 폰 번호 중복 확인 로직 추가 * remove: 안부전화 수정 api 제거
- Loading branch information
Showing
8 changed files
with
161 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,20 @@ void createSeniorTestWhenSinittoDoThis() { | |
assertThrows(BadRequestException.class, () -> guardService.createSenior(memberId, seniorRequest)); | ||
} | ||
|
||
@Test | ||
@DisplayName("createSenior 테스트 - 이미 등록된 번호로 시니어 생성하면 예외를 발생시켜야한다.") | ||
void createSeniorTestFailWhenDuplicatedPhoneNumber() { | ||
// Given | ||
Long memberId = 1L; | ||
Member member = new Member("testName", "01012345678", "[email protected]", false); | ||
SeniorRequest seniorRequest = new SeniorRequest("testSeniorName", "01011111111"); | ||
when(memberRepository.findById(memberId)).thenReturn(Optional.of(member)); | ||
when(seniorRepository.existsByPhoneNumber("01011111111")).thenReturn(true); | ||
|
||
// When, Then | ||
assertThrows(BadRequestException.class, () -> guardService.createSenior(memberId, seniorRequest)); | ||
} | ||
|
||
@Test | ||
@DisplayName("readSeniors 메소드 테스트") | ||
void readSeniorsTest() { | ||
|
@@ -177,6 +191,22 @@ void updateSeniorTest() { | |
verify(senior, times(1)).updateSenior(request.seniorName(), request.seniorPhoneNumber()); | ||
} | ||
|
||
@Test | ||
@DisplayName("updateSenior 메소드 테스트 - 이미 등록된 번호로 수정시 예외가 발생해야한다.") | ||
void updateSeniorTestFailWhenDuplicatedPhoneNumber() { | ||
//given | ||
Long memberId = 1L; | ||
Long seniorId = 2L; | ||
Member member = new Member("testName", "01012345678", "[email protected]", true); | ||
Senior senior = mock(Senior.class); | ||
SeniorRequest request = new SeniorRequest("newSeniorName", "01011111111"); | ||
|
||
when(seniorRepository.findByIdAndMemberId(seniorId, memberId)).thenReturn(Optional.of(senior)); | ||
when(seniorRepository.existsByPhoneNumber("01011111111")).thenReturn(true); | ||
//when then | ||
assertThrows(BadRequestException.class, () -> guardService.updateSenior(memberId, seniorId, request)); | ||
} | ||
|
||
@Test | ||
@DisplayName("deleteSenior 메소드 테스트") | ||
void deleteSeniorTest() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters