package com.github.j5ik2o.ddd_example;

import com.github.j5ik2o.ddd_example.domain.BankAccount;
import com.github.j5ik2o.ddd_example.domain.BankAccountService;
import com.github.j5ik2o.ddd_eaxmple.utils.IdGenerator;
import com.github.j5ik2o.ddd_example.domain.Money;
import org.junit.Test;

import java.math.BigDecimal;

public class BankAccountServiceTest {
    @Test
    public void transfer() throws Exception {
        Money baseMoney = Money.of(BigDecimal.valueOf(10000));
        BankAccount bankAccount1 = BankAccount.of(IdGenerator.generateId()).addIncrementAmount(baseMoney);
        BankAccount bankAccount2 = BankAccount.of(IdGenerator.generateId()).addIncrementAmount(baseMoney);

        System.out.println("bankAccount1 = " + bankAccount1.getTotalAmount());
        System.out.println("bankAccount2 = " + bankAccount2.getTotalAmount());

        BankAccountService.Result result = BankAccountService.transfer(
                bankAccount1,
                bankAccount2,
                Money.of(BigDecimal.valueOf(10000))
        );

        System.out.println("to = " + result.getTo().getTotalAmount());
        System.out.println("from = " + result.getFrom().getTotalAmount());
    }
}
@@ -468,24 +468,50 @@
 Of(10000));%0A
+        // %E5%8F%A3%E5%BA%A7%E3%82%92%E5%AE%A3%E8%A8%80%E3%81%97%E3%80%81%E5%88%9D%E6%9C%9F%E5%85%A5%E9%87%91%E3%82%92%E8%A1%8C%E3%81%86%0A
         Bank
@@ -605,16 +605,16 @@
 Money);%0A
-
         
@@ -868,24 +868,44 @@
 Amount());%0A%0A
+        // %E5%8F%A3%E5%BA%A7%E9%96%93%E9%80%81%E9%87%91%E3%82%92%E8%A1%8C%E3%81%86%0A
         Bank
@@ -1240,9 +1240,10 @@
 ;%0A    %7D%0A
-
 %7D
+%0A

Update BankAccountServiceTest.java