-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[BE] โป๏ธ refactor : member account ๊ด๊ณ ์ฌ์ค์
- Loading branch information
Showing
6 changed files
with
87 additions
and
9 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
71 changes: 71 additions & 0 deletions
71
Server/src/test/java/com/server/domain/adjustment/service/AdjustmentServiceTest.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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.server.domain.adjustment.service; | ||
|
||
import com.server.domain.account.domain.Account; | ||
import com.server.domain.adjustment.service.dto.request.AccountUpdateServiceRequest; | ||
import com.server.domain.member.entity.Member; | ||
import com.server.global.testhelper.ServiceTest; | ||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.DynamicTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.junit.jupiter.api.DynamicTest.*; | ||
|
||
class AdjustmentServiceTest extends ServiceTest { | ||
|
||
@Autowired AdjustmentService adjustmentService; | ||
|
||
@TestFactory | ||
@DisplayName("๊ณ์ข ์ ๋ณด๋ฅผ ์์ ํ๋ค.") | ||
Collection<DynamicTest> updateAccount() { | ||
//given | ||
Member member = createMemberWithChannel(); | ||
|
||
em.flush(); | ||
em.clear(); | ||
|
||
return List.of( | ||
dynamicTest("๊ณ์ข์ ๋ณด๊ฐ ์๋ค๋ฉด ์์ฑํ๋ค.", ()-> { | ||
//given | ||
String accountNumber = "123456789"; | ||
String bank = "์ ํ์ํ"; | ||
String name = "ํ๊ธธ๋"; | ||
|
||
AccountUpdateServiceRequest request = new AccountUpdateServiceRequest(name, accountNumber, bank); | ||
|
||
//when | ||
adjustmentService.updateAccount(member.getMemberId(), request); | ||
|
||
//then | ||
Account account = accountRepository.findByMemberId(member.getMemberId()).orElseThrow(); | ||
assertThat(account.getAccount()).isEqualTo(accountNumber); | ||
}), | ||
dynamicTest("๊ณ์ข์ ๋ณด๊ฐ ์๋ค๋ฉด ์์ ํ๋ค.", ()-> { | ||
//given | ||
String accountNumber = "1234567892"; | ||
String bank = "์ ํ์ํ2"; | ||
String name = "ํ๊ธธ๋2"; | ||
|
||
AccountUpdateServiceRequest request = new AccountUpdateServiceRequest(name, accountNumber, bank); | ||
|
||
//when | ||
adjustmentService.updateAccount(member.getMemberId(), request); | ||
|
||
//then | ||
Account account = accountRepository.findByMemberId(member.getMemberId()).orElseThrow(); | ||
assertThat(account.getAccount()).isEqualTo(accountNumber); | ||
assertThat(accountRepository.findAll().size()).isEqualTo(1); | ||
}) | ||
); | ||
|
||
|
||
} | ||
} |
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