From 3b9058128ed3d5d96928725413ea4977f690d0f2 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sat, 14 Jul 2018 12:28:00 -0700 Subject: Add data models for GroupSearch API --- .../ccbapi/model/SearchGroupsResponseTest.java | 50 ++++++++++++++++++++++ .../ccbapi/model/ccb_group_search_response.xml | 41 ++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 src/test/java/com/p4square/ccbapi/model/SearchGroupsResponseTest.java create mode 100644 src/test/resources/com/p4square/ccbapi/model/ccb_group_search_response.xml (limited to 'src/test') diff --git a/src/test/java/com/p4square/ccbapi/model/SearchGroupsResponseTest.java b/src/test/java/com/p4square/ccbapi/model/SearchGroupsResponseTest.java new file mode 100644 index 0000000..57aadfb --- /dev/null +++ b/src/test/java/com/p4square/ccbapi/model/SearchGroupsResponseTest.java @@ -0,0 +1,50 @@ +package com.p4square.ccbapi.model; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class SearchGroupsResponseTest extends XmlBinderTestBase { + + /** + * Assert that all of the fields bind appropriately for a single profile response. + */ + @Test + public void testGetGroupProfilesResponse() throws Exception { + final SearchGroupsResponse response = parseFile("ccb_group_search_response.xml", + SearchGroupsResponse.class); + + assertNull("Response should not have errors", response.getErrors()); + assertNotNull(response.getResults()); + assertEquals(1, response.getResults().size()); + + final GroupSearchResult group = response.getResults().get(0); + + // IDs + assertEquals(750, group.getId()); + + assertEquals("Adamant by Lisa Bevere Book Study", group.getName()); + assertTrue(group.getDescription().startsWith("What is the truth?")); + + // Main Leader + assertReferenceEquals(26102, "Jane Doe", group.getMainLeader()); + assertEquals("jane.doe@example.com", group.getMainLeaderEmail()); + + // Attributes + assertEquals(InteractionType.MEMBERS_INTERACT, group.getInteractionType()); + assertEquals(MembershipType.MODERATED, group.getMembershipType()); + + // Reference Attributes + assertEquals("Tuesday", group.getMeetingDayName()); + assertEquals("7:00 pm", group.getMeetingTimeName()); + assertEquals("Community", group.getGroupTypeName()); + assertEquals("Adults", group.getDepartmentName()); + assertReferenceEquals(18, "Puyallup", group.getArea()); + } + + private void assertReferenceEquals(int id, String name, Reference ref) { + assertEquals(id, ref.getId()); + assertEquals(name, ref.getName()); + } + +} \ No newline at end of file diff --git a/src/test/resources/com/p4square/ccbapi/model/ccb_group_search_response.xml b/src/test/resources/com/p4square/ccbapi/model/ccb_group_search_response.xml new file mode 100644 index 0000000..1e29c82 --- /dev/null +++ b/src/test/resources/com/p4square/ccbapi/model/ccb_group_search_response.xml @@ -0,0 +1,41 @@ + + + + + + + + + group_search + execute + public + + + 750 + 750 + Adamant by Lisa Bevere Book Study + Community + Adults + Puyallup + Tuesday + 7:00 pm + What is the truth? + + This has become the defining question of our time. But while everyone has an opinion, truth, it seems, is getting harder and harder to find. Perhaps that's because we are searching for something when we should be looking for someone. + + Truth has a name. + + More ancient than time and more present than this moment, the truth is not a river that changes with the cultural currents, but a rock--immovable, invincible, unshakeable--and the cornerstone of all we are and ever dream to be. + + 100 79588 0 79588 0 0 39774 0 --:--:-- 0:00:02 -Theologically deep yet intimately accessible. Adamant will be an anchor for your soul in a raging sea of opinions, giving you a clear sense of direction in a wandering world. + Every Other Tuesday Beginning in September 2018 + 1 + Interact + Request + Jane Doe + jane.doe@example.com + + + + + \ No newline at end of file -- cgit v1.2.3