package ru.matevosyan;

import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

/**
 * Created by Admin on 27.04.2017.
 */
public class BankTest {

    @Test
    public void whenTransferAmountThanCheckThisAmount() {

        //assign
        Bank bank = new Bank();

        User firstUser = new User("Tom", "KO23423F");
        Account firstUserAccount = new Account(50.50, "G45FD45-567");

        User secondUser = new User("Luis", "KG56423F");
        Account secondUserAccount = new Account(0.0, "G4H8F45-997");

        //act
        bank.addUser(firstUser);
        bank.addAccountToUser(firstUser, firstUserAccount);

        bank.addUser(secondUser);
        bank.addAccountToUser(secondUser, secondUserAccount);

        bank.transferMoney(firstUser, firstUserAccount, secondUser, secondUserAccount, 10);

        //assert
//        assertThat(bank.getUserAccounts(secondUser).get(0).getValue(),is(10.0));
        assertThat(secondUserAccount.getValue(),is(10.0));
    }

}
@@ -154,22 +154,53 @@
 ted 
-by Admin
+BankTest to test Bank class.%0A * Created
  on 2
-7
+8
 .04.
@@ -209,12 +209,58 @@
 17.%0A
+ * @author Matevosyan Vardan%0A * @version 1.0%0A
  */%0A
+%0A
 publ
@@ -288,44 +288,335 @@
     
-@Test%0A    public void whenTransferAm
+/**%0A     * Created whenTransferAmountFromFirstUserAccountToSecondUserAccountThanCheckThisAmount, to test transfer skills.%0A     * Testing when one user transfer amount from his first account to another one, who takes amount to his account.%0A     */%0A%0A    @Test%0A    public void whenTransferAmountFromFirstUserAccountToSecondUserAcc
 ount
@@ -937,24 +937,149 @@
 F45-997%22);%0A%0A
+        double amountToTransfer = 10.0;%0A        double expectedLastAmount = firstUserAccount.getValue() - amountToTransfer;%0A%0A
         //ac
@@ -1358,18 +1358,32 @@
 ccount, 
-10
+amountToTransfer
 );%0A%0A    
@@ -1395,18 +1395,16 @@
 /assert%0A
-//
         
@@ -1418,95 +1418,1250 @@
 hat(
-bank.getUserAccounts(secondUser).get(0).getValue(),is(10.0));%0A        assertThat(second
+secondUserAccount.getValue(),is(amountToTransfer));%0A        assertThat(firstUserAccount.getValue(),is(expectedLastAmount));%0A    %7D%0A%0A    /**%0A     * Created whenTransferAmountFromFirstUserAccountToSecondUserAccountThanCheckThisAmount, to test transfer skills.%0A     * Testing when one user transfer amount from his first account to his own account.%0A     */%0A%0A    @Test%0A    public void whenTransferAmountFromFirstUserAccountToFirstUserSecondAccountThanCheckThisAmount() %7B%0A%0A        //assign%0A        Bank bank = new Bank();%0A%0A        User firstUser = new User(%22Tom%22, %22KO23423F%22);%0A        Account firstUserAccount = new Account(50.50, %22G45FD45-567%22);%0A        Account firstUserSecondAccount = new Account(0.0, %22G4H8F45-997%22);%0A        double amountToTransfer = 35.5;%0A        double expectedLastAmount = firstUserAccount.getValue() - amountToTransfer;%0A%0A        //act%0A        bank.addUser(firstUser);%0A        bank.addAccountToUser(firstUser, firstUserAccount);%0A        bank.addAccountToUser(firstUser, firstUserSecondAccount);%0A%0A        bank.transferMoney(firstUser, firstUserAccount, firstUser, firstUserSecondAccount, amountToTransfer);%0A%0A        //assert%0A        assertThat(firstUserSecondAccount.getValue(),is(amountToTransfer));%0A        assertThat(first
 User
@@ -2682,20 +2682,34 @@
 ue(),is(
-10.0
+expectedLastAmount
 ));%0A    

add new method and all test is passed, yahoooo))