Package accounts

Examples of accounts.Account


    assertFalse("Should not support and AccountValidator class", validator.supports(AccountValidator.class));
  }

  @Test
  public void testNumberInUseBySameAccount() {
    Account account = new Account("123456789", "Keith and Keri Donald");
    account.setEntityId(0L);
    Errors errors = new BeanPropertyBindingResult(account, "account");
    validator.validate(account, errors);
    assertEquals("No errors should be registered", 0, errors.getErrorCount());
  }
View Full Code Here


    assertEquals("No errors should be registered", 0, errors.getErrorCount());
  }
 
  @Test
  public void testNumberInUseByAnotherAccount() {
    Account account = new Account("123456001", "Keith and Keri Donald");
    account.setEntityId(0L);
    Errors errors = new BeanPropertyBindingResult(account, "account");
    validator.validate(account, errors);
    assertEquals("One error should be registered", 1, errors.getErrorCount());
    FieldError error = errors.getFieldError("number");
    assertNotNull(error);
View Full Code Here

    assertEquals("account.number.inuse", error.getCode());
  }
 
  @Test
  public void testNumberDoesNotExist() {
    Account account = new Account("100", "Anything");
    account.setEntityId(0L);
    Errors errors = new BeanPropertyBindingResult(account, "account");
    validator.validate(account, errors);
    assertEquals("No errors should be registered", 0, errors.getErrorCount());
  }
View Full Code Here

    assertEquals("No errors should be registered", 0, errors.getErrorCount());
  }

  @Test
  public void testNoNumberProvided() {
    Account account = new Account("", "");
    account.setEntityId(0L);
    Errors errors = new BeanPropertyBindingResult(account, "account");
    validator.validate(account, errors);
    assertEquals("No errors should be registered", 0, errors.getErrorCount());
  }
View Full Code Here

  }

  // Unit tests for the accountDetails method....
  @Test
  public void testAccountDetails() throws Exception {
    Account account = controller.accountDetails(new Long(0));
    assertEquals(Long.valueOf(0), account.getEntityId());
  }
View Full Code Here

  private Map<Long, Account> accountsById = new HashMap<Long, Account>();
  private Map<String, Account> accountsByNumber = new HashMap<String, Account>();

  public StubAccountManager() {
    String number = "123456789";
    Account account = new Account(number, "Keith and Keri Donald");
    account.addBeneficiary("Annabelle", Percentage.valueOf("50%"));
    account.addBeneficiary("Corgan", Percentage.valueOf("50%"));
    account.setEntityId(0L);
    accountsById.put(Long.valueOf(0), account);
    accountsByNumber.put("123456789", account);
   
    number = "123456001";
    account = new Account(number, "Dollie R. Adams");
    account.setEntityId(1L);
    accountsById.put(Long.valueOf(1), account);
    accountsByNumber.put(number, account);
  }
View Full Code Here

  public List<Account> getAllAccounts() {
    return new ArrayList<Account>(accountsById.values());
  }

  public Account getAccount(Long id) {
    Account account = accountsById.get(id);
    if (account == null) {
      throw new ObjectRetrievalFailureException(Account.class, id);
    }
    return account;
  }
View Full Code Here

  public void update(Account account) {
    accountsById.put(account.getEntityId(), account);
  }

  public void updateBeneficiaryAllocationPercentages(Long accountId, Map<String, Percentage> allocationPercentages) {
    Account account = accountsById.get(accountId);
    for (Entry<String, Percentage> entry : allocationPercentages.entrySet()) {
      account.getBeneficiary(entry.getKey()).setAllocationPercentage(entry.getValue());
    }
  }
View Full Code Here

    request.addParameter("entityId", "0");
    ModelAndView mav = controller.accountDetails(request);
    assertNotNull(mav);
    assertEquals(1, mav.getModel().size());
    assertTrue(mav.getModel().containsKey("account"));
    Account acc = (Account)mav.getModel().get("account");
    assertEquals(Long.valueOf(0), acc.getEntityId());
  }
View Full Code Here

  }

  // Unit tests for the accountDetails method....
  @Test
  public void testAccountDetails() throws Exception {
    Account account = controller.accountDetails(new Long(0));
    assertEquals(Long.valueOf(0), account.getEntityId());
  }
View Full Code Here

TOP

Related Classes of accounts.Account

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.