From b9eb1329a6dbec7b75c21d8e0eb13134121db6bb Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sat, 19 Mar 2016 02:05:33 -0700 Subject: Initial commit for the CCB API Client. The client currently supports the following APIs: * individual_profiles * individual_profile_from_id * individual_profile_from_login_password * individual_profile_from_micr * custom_field_labels --- .../model/GetIndividualProfilesResponseTest.java | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java (limited to 'src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java') diff --git a/src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java b/src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java new file mode 100644 index 0000000..743a9f7 --- /dev/null +++ b/src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java @@ -0,0 +1,60 @@ +package com.p4square.ccbapi.model; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Tests for parsing GetIndividualProfilesResponse. + */ +public class GetIndividualProfilesResponseTest extends XmlBinderTestBase { + + /** + * Assert that all of the fields bind appropriately for a single profile response. + */ + @Test + public void testGetIndividualProfilesResponse() throws Exception { + final GetIndividualProfilesResponse response = parseFile("ccb_individual_profile_response.xml", + GetIndividualProfilesResponse.class); + + assertNull("Response should not have errors", response.getErrors()); + assertNotNull(response.getIndividuals()); + assertEquals(1, response.getIndividuals().size()); + + final IndividualProfile profile = response.getIndividuals().get(0); + + // IDs + assertEquals(48, profile.getId()); + assertEquals(123, profile.getSyncId()); + assertEquals(456, profile.getOtherId()); + + // Family + assertEquals(36, profile.getFamily().getFamilyId()); + assertEquals("The Bob Family", profile.getFamily().getName()); + assertEquals("https://cdn3.ccbchurch.com/preSTABLE/images/group-default.gif", profile.getFamilyImageUrl()); + assertEquals(FamilyPosition.PRIMARY_CONTACT, profile.getFamilyPosition()); + assertEquals(1, profile.getFamilyMembers().size()); + + // Mrs. Bob + assertEquals(49, profile.getFamilyMembers().get(0).getIndividualReference().getIndividualId()); + assertEquals("Mrs. Bob", profile.getFamilyMembers().get(0).getIndividualReference().getName()); + assertEquals(FamilyPosition.SPOUSE, profile.getFamilyMembers().get(0).getFamilyPosition()); + + // Names + assertEquals("Mr.", profile.getSalutation()); + assertEquals("Larry", profile.getFirstName()); + assertEquals("", profile.getMiddleName()); + assertEquals("Bob", profile.getLastName()); + assertEquals("", profile.getSuffix()); + assertEquals("Larabar", profile.getLegalFirstName()); + assertEquals("Larry Bob", profile.getFullName()); + + // Other Attributes + assertEquals("https://cdn3.ccbchurch.com/preSTABLE/images/profile-default.gif", profile.getImageUrl()); + assertEquals("tsebastian@churchcommunitybuilder.com", profile.getEmail()); + assertEquals("", profile.getAllergies()); + assertEquals(true, profile.isConfirmedNoAllergies()); + assertEquals(Gender.MALE, profile.getGender()); + assertEquals("1990-04-05", profile.getBirthday().toString()); + } +} \ No newline at end of file -- cgit v1.2.3