-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [feat] Customer ID 변경 - 논의 - #36 반영 - Long 에서 UUID 로 변경 * [fix] Customer ID 변경으로 인한 수정 - 논의 - #36 반영 - Long 에서 UUID 로 변경 * [test] SignUpCustomerServiceIntegrationTest 수정 - DataIntegrityViolationException 를 서비스 레이어에서 잡지 못하면 에러 명시된 출럭 * [chore] 불필요한 throws 제거 * [fix] SignUpCustomerService.signUp 변경에 의한 검증 변경 - then().save() -> then().saveAndFlush() * [fix] Customer id 변경에 의한 수정 - Customer id: Long -> UUID 변경 * [fix] Customer id 변경에 의한 수정 - Customer id: Long -> UUID 변경 * [feat] LoginMember 수정 - getId() 의 반환값 UUID 로 변경 * [feat] LoginMember 수정 - getId() 의 반환값 Object 로 변경 * [chore] 사용하지 않는 () 제거
- Loading branch information
Showing
12 changed files
with
62 additions
and
43 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
4 changes: 3 additions & 1 deletion
4
src/main/java/camp/woowak/lab/payaccount/service/command/PayAccountChargeCommand.java
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package camp.woowak.lab.payaccount.service.command; | ||
|
||
import java.util.UUID; | ||
|
||
public record PayAccountChargeCommand( | ||
Long customerId, | ||
UUID customerId, | ||
long amount) { | ||
} |
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
8 changes: 5 additions & 3 deletions
8
src/main/java/camp/woowak/lab/web/authentication/LoginCustomer.java
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 |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package camp.woowak.lab.web.authentication; | ||
|
||
import java.util.UUID; | ||
|
||
public class LoginCustomer implements LoginMember { | ||
private final Long id; | ||
private final UUID id; | ||
|
||
public LoginCustomer(Long id) { | ||
public LoginCustomer(UUID id) { | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public Long getId() { | ||
public UUID getId() { | ||
return id; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/camp/woowak/lab/web/dto/response/customer/SignUpCustomerResponse.java
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package camp.woowak.lab.web.dto.response.customer; | ||
|
||
public record SignUpCustomerResponse(Long id) { | ||
public record SignUpCustomerResponse(String id) { | ||
} |
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 |
---|---|---|
|
@@ -6,9 +6,9 @@ | |
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.dao.DataIntegrityViolationException; | ||
|
||
import camp.woowak.lab.customer.exception.DuplicateEmailException; | ||
import camp.woowak.lab.customer.exception.InvalidCreationException; | ||
import camp.woowak.lab.customer.repository.CustomerRepository; | ||
import camp.woowak.lab.customer.service.command.SignUpCustomerCommand; | ||
import camp.woowak.lab.payaccount.repository.PayAccountRepository; | ||
|
@@ -27,7 +27,7 @@ class SignUpCustomerServiceIntegrationTest { | |
|
||
@Test | ||
@DisplayName("이메일 중복 시 롤백 테스트") | ||
void testRollbackOnDuplicateEmail() throws InvalidCreationException, DuplicateEmailException { | ||
void testRollbackOnDuplicateEmail() { | ||
// given | ||
SignUpCustomerCommand command1 = new SignUpCustomerCommand("name1", "[email protected]", "password", | ||
"010-1234-5678"); | ||
|
@@ -43,10 +43,11 @@ void testRollbackOnDuplicateEmail() throws InvalidCreationException, DuplicateEm | |
// then | ||
try { | ||
service.signUp(command2); | ||
fail("중복 이메일 예외가 발생해야 합니다."); | ||
} catch (DuplicateEmailException e) { | ||
assertEquals(1, customerRepository.count()); | ||
assertEquals(1, payAccountRepository.count()); | ||
} catch (DataIntegrityViolationException e) { | ||
fail("DataIntegrityViolationException이 발생했습니다."); | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; | ||
|
||
import java.util.UUID; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
@@ -38,9 +40,10 @@ class CustomerApiControllerTest { | |
@DisplayName("구매자 회원가입 테스트 - 성공") | ||
void testSignUpCustomer() throws Exception { | ||
// given | ||
String customerId = UUID.randomUUID().toString(); | ||
SignUpCustomerRequest request = new SignUpCustomerRequest("name", "[email protected]", "password123", | ||
"010-1234-5678"); | ||
given(signUpCustomerService.signUp(any())).willReturn(1L); | ||
given(signUpCustomerService.signUp(any())).willReturn(customerId); | ||
|
||
// when & then | ||
mockMvc.perform(post("/customers") | ||
|