diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2016-03-19 02:05:33 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2016-03-19 02:07:24 -0700 |
commit | b9eb1329a6dbec7b75c21d8e0eb13134121db6bb (patch) | |
tree | fec73ab32ff625c304513c24e864809845eede1a /src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java |
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
Diffstat (limited to 'src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java')
-rw-r--r-- | src/test/java/com/p4square/ccbapi/model/GetIndividualProfilesResponseTest.java | 60 |
1 files changed, 60 insertions, 0 deletions
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 |