Package accounts

Examples of accounts.Account


   * Performs validations for the given account. The main validation
   * is against the account number, which can be changed but not to
   * a number that's already in use by another account.
   */
  public void validate(Object target, Errors errors) {
    Account account = (Account) target;
    if (StringUtils.isNotEmpty(account.getNumber())) {
      Account existingAccount = accountManager.findAccount(account.getNumber());
      if (existingAccount != null) {
        if (! account.getEntityId().equals(existingAccount.getEntityId())) {
          errors.rejectValue("number", "account.number.inuse");
        }
      }
    }
//    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "errors.required", new String[]{"name"});
View Full Code Here


    getCurrentSession().update(account);
  }

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

    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

    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

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.