use of org.killbill.billing.account.api.DefaultAccount in project killbill by killbill.
the class TestDefaultAccountUserApi method testAccountResetCurrency.
@Test(groups = "slow", description = "Test failure on resetting currency", expectedExceptions = IllegalArgumentException.class)
public void testAccountResetCurrency() throws Exception {
final Account account = createAccount(new DefaultAccount(createTestAccount()));
// Update the address and leave other fields null
final MutableAccountData mutableAccountData = new DefaultMutableAccountData(account);
mutableAccountData.setCurrency(null);
DefaultAccount newAccount = new DefaultAccount(account.getId(), mutableAccountData);
accountUserApi.updateAccount(newAccount, callContext);
}
use of org.killbill.billing.account.api.DefaultAccount in project killbill by killbill.
the class TestDefaultAccountUserApi method testShouldntBeAbleToUpdateCurrency.
@Test(groups = "slow", expectedExceptions = IllegalArgumentException.class, description = "Test updating Account currency throws an exception")
public void testShouldntBeAbleToUpdateCurrency() throws Exception {
final Account account = createAccount(new DefaultAccount(createTestAccount()));
final MutableAccountData otherAccount = new DefaultAccount(account.getId(), account).toMutableAccountData();
otherAccount.setCurrency(Currency.GBP);
accountUserApi.updateAccount(new DefaultAccount(account.getId(), otherAccount), callContext);
}
use of org.killbill.billing.account.api.DefaultAccount in project killbill by killbill.
the class TestDefaultAccountUserApi method testCreateChildAccountWithInvalidParent.
@Test(groups = "slow", description = "Test Account create Child with a non existing Parent", expectedExceptions = AccountApiException.class, expectedExceptionsMessageRegExp = "Account does not exist for id .*")
public void testCreateChildAccountWithInvalidParent() throws Exception {
final AccountModelDao childAccountModel = createTestAccount();
childAccountModel.setParentAccountId(UUID.randomUUID());
final AccountData childAccountData = new DefaultAccount(childAccountModel);
final Account childAccount = accountUserApi.createAccount(childAccountData, callContext);
}
use of org.killbill.billing.account.api.DefaultAccount in project killbill by killbill.
the class TestDefaultAccountUserApi method testCreateAccountWithExternalKeyOverLimit.
@Test(groups = "slow", description = "Test Account creation with External Key over limit")
public void testCreateAccountWithExternalKeyOverLimit() throws Exception {
AccountModelDao accountModelDao = createTestAccount();
// Set an externalKey of 256 characters (over limit)
accountModelDao.setExternalKey("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,.");
final AccountData accountData = new DefaultAccount(accountModelDao);
try {
accountUserApi.createAccount(accountData, callContext);
Assert.fail();
} catch (final AccountApiException e) {
assertEquals(e.getCode(), ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED.getCode());
}
}
use of org.killbill.billing.account.api.DefaultAccount in project killbill by killbill.
the class TestDefaultAccountUserApi method testShouldntBeAbleToUpdateBillCycleDay.
@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);
}
Aggregations