Package accounts

Examples of accounts.Beneficiary


    assertEquals("wrong entity id", Long.valueOf(0), account.getEntityId());
    assertEquals("wrong account number", "123456789", account.getNumber());
    assertEquals("wrong name", "Keith and Keri Donald", account.getName());
    assertEquals("wrong beneficiary collection size", 2, account.getBeneficiaries().size());

    Beneficiary b1 = account.getBeneficiary("Annabelle");
    assertNotNull("Annabelle should be a beneficiary", b1);
    assertEquals("wrong savings", MonetaryAmount.valueOf("0.00"), b1.getSavings());
    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b1.getAllocationPercentage());

    Beneficiary b2 = account.getBeneficiary("Corgan");
    assertNotNull("Corgan should be a beneficiary", b2);
    assertEquals("wrong savings", MonetaryAmount.valueOf("0.00"), b2.getSavings());
    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b2.getAllocationPercentage());
  }
View Full Code Here


  }   
 
  public void saveBeneficiary(Long accountId, Long id, String name,
      String allocationPercentage) {
   
    Beneficiary beneficiary = new Beneficiary(name, Percentage.valueOf(allocationPercentage));
    if(id.longValue() != -1){
      beneficiary.setEntityId(id);     
    }

    Account account = hibernateTemplate.get(Account.class, accountId);
    beneficiary.setAccount(account);
    hibernateTemplate.saveOrUpdate(beneficiary)
   
  }
View Full Code Here

    assertEquals("wrong entity id", Long.valueOf(1), account.getEntityId());
    assertEquals("wrong account number", "123456789", account.getNumber());
    assertEquals("wrong name", "Keith and Keri Donald", account.getName());
    assertEquals("wrong beneficiary collection size", 2, account.getBeneficiaries().size());

    Beneficiary b1 = account.getBeneficiary("Annabelle");
    assertNotNull("Annabelle should be a beneficiary", b1);
    assertEquals("wrong savings", MonetaryAmount.valueOf("0.00"), b1.getSavings());
    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b1.getAllocationPercentage());

    Beneficiary b2 = account.getBeneficiary("Corgan");
    assertNotNull("Corgan should be a beneficiary", b2);
    assertEquals("wrong savings", MonetaryAmount.valueOf("0.00"), b2.getSavings());
    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b2.getAllocationPercentage());
  }
View Full Code Here

  }
 
  private static final class BeneficiaryMapper implements RowMapper<Beneficiary> {

      public Beneficiary mapRow(ResultSet rs, int rowNum) throws SQLException {
        Beneficiary beneficiary = new Beneficiary();
       
        beneficiary.setEntityId(rs.getLong("id"));
        beneficiary.setName(rs.getString("name"));
       
        Percentage percentage = new Percentage(rs.getDouble("allocation_percentage"));
        beneficiary.setAllocationPercentage(percentage);
       
        MonetaryAmount amount = new MonetaryAmount(rs.getDouble("savings"));
        beneficiary.setSavings(amount);
       
        Account account = new Account();
        account.setEntityId(rs.getLong("account_id"));
        beneficiary.setAccount(account);
       
          return beneficiary;
      }       
View Full Code Here

    assertEquals("wrong entity id", Long.valueOf(0), account.getEntityId());
    assertEquals("wrong account number", "123456789", account.getNumber());
    assertEquals("wrong name", "Keith and Keri Donald", account.getName());
    assertEquals("wrong beneficiary collection size", 2, account.getBeneficiaries().size());

    Beneficiary b1 = account.getBeneficiary("Annabelle");
    assertNotNull("Annabelle should be a beneficiary", b1);
    assertEquals("wrong savings", MonetaryAmount.valueOf("0.00"), b1.getSavings());
    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b1.getAllocationPercentage());

    Beneficiary b2 = account.getBeneficiary("Corgan");
    assertNotNull("Corgan should be a beneficiary", b2);
    assertEquals("wrong savings", MonetaryAmount.valueOf("0.00"), b2.getSavings());
    assertEquals("wrong allocation percentage", Percentage.valueOf("50%"), b2.getAllocationPercentage());
  }
View Full Code Here

TOP

Related Classes of accounts.Beneficiary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.