コード例 #1
0
  @Test(
      groups = "slow",
      expectedExceptions = IllegalArgumentException.class,
      description = "Test updating Account BCD does throws an exception")
  public void testShouldntBeAbleToUpdateBillCycleDay() throws Exception {
    final Account account = createAccount(new DefaultAccount(createTestAccount()));

    final MutableAccountData otherAccount =
        new DefaultAccount(account.getId(), account).toMutableAccountData();
    otherAccount.setBillCycleDayLocal(account.getBillCycleDayLocal() + 2);

    accountUserApi.updateAccount(new DefaultAccount(account.getId(), otherAccount), callContext);
  }
コード例 #2
0
  @Test(
      groups = "slow",
      expectedExceptions = IllegalArgumentException.class,
      description = "Test updating Account externalKey throws an exception")
  public void testShouldntBeAbleToUpdateExternalKey() throws Exception {
    final Account account = createAccount(new DefaultAccount(createTestAccount()));

    final MutableAccountData otherAccount =
        new DefaultAccount(account.getId(), account).toMutableAccountData();
    otherAccount.setExternalKey(UUID.randomUUID().toString());

    accountUserApi.updateAccount(new DefaultAccount(account.getId(), otherAccount), callContext);
  }
コード例 #3
0
  @Test(groups = "slow", description = "Test Account update with null values")
  public void testShouldBeAbleToPassNullForSomeFieldsToAvoidUpdate() throws Exception {
    final Account account = createAccount(new DefaultAccount(createTestAccount()));

    // Update the address and leave other fields null
    final MutableAccountData mutableAccountData =
        new DefaultMutableAccountData(
            null, null, null, 0, null, null, false, 0, null, null, null, null, null, null, null,
            null, null, null, null, null, false, false);
    final String newAddress1 = UUID.randomUUID().toString();
    mutableAccountData.setAddress1(newAddress1);

    accountUserApi.updateAccount(account.getId(), mutableAccountData, callContext);

    final Account retrievedAccount = accountUserApi.getAccountById(account.getId(), callContext);
    Assert.assertEquals(retrievedAccount.getAddress1(), newAddress1);
    Assert.assertEquals(retrievedAccount.getAddress2(), account.getAddress2());
    Assert.assertEquals(retrievedAccount.getCurrency(), account.getCurrency());
    Assert.assertEquals(retrievedAccount.getExternalKey(), account.getExternalKey());
    Assert.assertEquals(retrievedAccount.getBillCycleDayLocal(), account.getBillCycleDayLocal());
  }