@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); }
@Test(groups = "slow", description = "Test failure on changing externalKey", expectedExceptions = IllegalArgumentException.class) public void testAccountChangeExternalKey() throws Exception { final Account account = createAccount(new DefaultAccount(createTestAccount())); // Update the address and leave other fields null final MutableAccountData mutableAccountData = new DefaultMutableAccountData(account); mutableAccountData.setExternalKey("somethingVeryDifferent"); DefaultAccount newAccount = new DefaultAccount(account.getId(), mutableAccountData); accountUserApi.updateAccount(newAccount, callContext); }
@Test(groups = "slow", description = "Test failure on resetting externalKey", expectedExceptions = IllegalArgumentException.class) public void testAccountResetExternalKey() throws Exception { final Account account = createAccount(new DefaultAccount(createTestAccount())); // Update the address and leave other fields null final MutableAccountData mutableAccountData = new DefaultMutableAccountData(account); mutableAccountData.setExternalKey(null); DefaultAccount newAccount = new DefaultAccount(account.getId(), mutableAccountData); accountUserApi.updateAccount(newAccount, callContext); }