Esempio n. 1
0
 @Test
 public void testBankAccounts() throws HTTPError {
   Customer customer = createPersonCustomer();
   BankAccount ba = createBankAccount();
   assertNotNull(ba);
   assertNotNull(ba.href);
   ba.associateToCustomer(customer);
   assertEquals(ba.href, customer.bank_accounts.iterator().next().href);
 }
Esempio n. 2
0
  @Test
  public void defaultBankAccountNumber() {

    String accountNumber = fake.getAccountNumber();

    assertThat(accountNumber, is(""));
  }
  /** Test method for {@link edu.cecs274.BankCustomer#getTotalBalance()}. */
  @Test
  public void testGetTotalBalance() {
    BankAccount oneAccount = new BankAccount(aCustomer, INITIAL_ACCOUNT_NUMBER, INITIAL_BALANCE);
    BankAccount twoAccount = new BankAccount(aCustomer, INITIAL_ACCOUNT_NUMBER + 1);
    BankAccount threeAccount = new BankAccount(aCustomer, INITIAL_ACCOUNT_NUMBER + 2);
    aCustomer.addAccount(oneAccount);
    aCustomer.addAccount(twoAccount);
    aCustomer.addAccount(threeAccount);

    double expected = INITIAL_BALANCE;
    double totalBalance = aCustomer.getTotalBalance();
    assertEquals(expected, totalBalance, DELTA);

    // Adds more money to twoAccount, the change should be reflected in aCustomers totalBalance
    twoAccount.deposit(INITIAL_BALANCE);
    expected = INITIAL_BALANCE * 2;
    totalBalance = aCustomer.getTotalBalance();
    assertEquals(expected, totalBalance, DELTA);
  }
Esempio n. 4
0
  @Test
  public void initiliazationOfTheIdOfAFakeBankAccount() {

    assertThat(fake.getId(), is(equalTo(Long.MIN_VALUE)));
  }
Esempio n. 5
0
  @Test
  public void overridesToString() {

    assertThat(fake.toString(), is("FakeBankAccount"));
  }