Skip to content

Commit

Permalink
refactor : PayRequest 엔티티가 target으로부터 돈을 받는 행동을 가지도록 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seongjunnoh committed Nov 20, 2024
1 parent b93b6a7 commit 844c2c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public void changeCompleteStatus(boolean isComplete) {
this.isComplete = isComplete;
}

public void changeReceiveAmount(int receiveAmount) {
this.receiveAmount = receiveAmount;
public void receiveMoneyFromTarget(int money) {
receiveAmount += money;
}

public void addPayRequestTarget(PayRequestTarget payRequestTarget) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import space.space_spring.domain.user.model.entity.User;
import space.space_spring.entity.enumStatus.UserSignupType;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

class PayRequestTest {
Expand All @@ -30,7 +28,7 @@ void getPayRequestInfo() throws Exception {
// target1 : 미정산, target2, target3 : 정산 완료
target2.changeCompleteStatus(true);
target3.changeCompleteStatus(true);
payRequest.changeReceiveAmount(20000);
payRequest.receiveMoneyFromTarget(20000);

//when
PayRequestInfoDto payRequestInfo = payRequest.getPayRequestInfo();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package space.space_spring.domain.pay.model.firstCollection;

import org.assertj.core.groups.Tuple;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand All @@ -14,7 +13,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.junit.jupiter.api.Assertions.*;

class PayRequestsTest {

Expand Down Expand Up @@ -47,10 +45,10 @@ void getPayRequestInfos() throws Exception {
PayRequestTarget target4 = PayRequestTarget.create(payRequest2, 4L, 30000);

target1.changeCompleteStatus(true); // payRequest1 에 대해서 target1은 정산 완료
payRequest1.changeReceiveAmount(20000);
payRequest1.receiveMoneyFromTarget(20000);

target3.changeCompleteStatus(true); // payRequest2 에 대해서 target3은 정산 완료
payRequest2.changeReceiveAmount(10000);
payRequest2.receiveMoneyFromTarget(10000);

PayRequests payCreatorIsSeongjun = PayRequests.create(List.of(payRequest1, payRequest2));

Expand Down

0 comments on commit 844c2c2

Please sign in to comment.