diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2018-08-19 15:57:06 -0700 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net> | 2018-08-19 15:57:06 -0700 | 
| commit | 54a7a3184dc565fe513aa520e1344b2303ea6834 (patch) | |
| tree | 5f66d23cdbec36b4e9e9935688780f216caf4da7 /src/test/java/com/p4square/ccbapi | |
| parent | 9cbf7a7a27977e32c8e275d2bc660787b20ce345 (diff) | |
Diffstat (limited to 'src/test/java/com/p4square/ccbapi')
| -rw-r--r-- | src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java | 18 | ||||
| -rw-r--r-- | src/test/java/com/p4square/ccbapi/model/GetCampusListResponseTest.java | 30 | 
2 files changed, 48 insertions, 0 deletions
| diff --git a/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java b/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java index 9c7bbd6..22f9046 100644 --- a/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java +++ b/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java @@ -129,6 +129,24 @@ public class CCBAPIClientTest {          assertEquals("High School Graduation", response.getItems().get(0).getName());      } +    @Test +    public void testGetCampusList() throws Exception { +        // Set expectation. +        URI expectedURI = new URI("https://localhost:8080/api.php?srv=campus_list"); +        InputStream is = getClass().getResourceAsStream("model/ccb_campus_list_response.xml"); +        EasyMock.expect(mockHttpClient.sendPostRequest(expectedURI, null)) +                .andReturn(is); +        EasyMock.replay(mockHttpClient); + +        // Test significant_event_list. +        GetCampusListResponse response = client.getCampusList(); + +        // Verify results. +        EasyMock.verify(mockHttpClient); +        assertNull(response.getErrors()); +        assertEquals(1, response.getCampuses().size()); +    } +      @Test(expected = IllegalArgumentException.class)      public void testGetLookupTableListWithNullType() throws Exception {          // This should throw an IllegalArgumentException. diff --git a/src/test/java/com/p4square/ccbapi/model/GetCampusListResponseTest.java b/src/test/java/com/p4square/ccbapi/model/GetCampusListResponseTest.java new file mode 100644 index 0000000..9b635db --- /dev/null +++ b/src/test/java/com/p4square/ccbapi/model/GetCampusListResponseTest.java @@ -0,0 +1,30 @@ +package com.p4square.ccbapi.model; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Tests for parsing GetCampusListResponseTest. + */ +public class GetCampusListResponseTest extends XmlBinderTestBase { + +    /** +     * Assert that all of the fields bind appropriately. +     */ +    @Test +    public void testGetCampusListResponse() throws Exception { +        final GetCampusListResponse response = parseFile("ccb_campus_list_response.xml", +                GetCampusListResponse.class); + +        assertNull("Response should not have errors", response.getErrors()); +        assertNotNull(response.getCampuses()); +        assertEquals(1, response.getCampuses().size()); + +        final Campus campus = response.getCampuses().get(0); + +        assertEquals(1, campus.getId()); +        assertEquals("Sample Church", campus.getName()); +        assertEquals(true, campus.isActive()); +    } +}
\ No newline at end of file | 
