Skip to content

Commit c69d6ce

Browse files
committed
Test Added for Zero CIM Profile Request
1 parent d8045d9 commit c69d6ce

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

src/test/java/net/authorize/cim/functional_test/CIMTest.java

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,41 @@ private MyReturnValuesTest createCustomerProfileWithAuthOnly(
876876

877877
return new MyReturnValuesTest(customerProfileId, null, customerPaymentProfileId, null, authCode, splitTenderId, transactionId, customerShippingAddressId);
878878
}
879-
879+
880+
@SuppressWarnings("unchecked")
881+
@Test
882+
public void testZeroCustomerProfile() {
883+
// get all existing customer profile ids
884+
net.authorize.cim.Transaction transaction = merchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE_IDS);
885+
Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(transaction);
886+
ArrayList<String> customerProfileIds = result.getCustomerProfileIdList();
887+
888+
// delete all existing customer profile
889+
for (int i = 0; i < customerProfileIds.size(); i++) {
890+
transaction = merchant.createCIMTransaction(TransactionType.DELETE_CUSTOMER_PROFILE);
891+
transaction.setCustomerProfileId(customerProfileIds.get(i));
892+
result = (Result<Transaction>) merchant.postTransaction(transaction);
893+
}
894+
895+
// test for getCustomerProfileIds request
896+
transaction = merchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE_IDS);
897+
result = (Result<Transaction>) merchant.postTransaction(transaction);
898+
Assert.assertNotNull(result);
899+
result.printMessages();
900+
Assert.assertTrue(result.isOk());
901+
Assert.assertTrue(result.getCustomerProfileIdList().isEmpty());
902+
903+
// test for getCustomerProfile request
904+
transaction = merchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE);
905+
transaction.setCustomerProfileId("1001");
906+
result = (Result<Transaction>) merchant.postTransaction(transaction);
907+
Assert.assertNotNull(result);
908+
result.printMessages();
909+
Assert.assertTrue(result.isError());
910+
Assert.assertNull(result.getCustomerProfileId());
911+
Assert.assertNull(result.getCustomerProfile());
912+
Assert.assertTrue(result.getCustomerPaymentProfileIdList().isEmpty());
913+
}
880914
private String createdCustomerPaymentProfileId = null;
881915
}
882916

0 commit comments

Comments
 (0)