diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2016-04-06 21:25:41 -0700 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net> | 2016-04-06 21:26:19 -0700 | 
| commit | 624e5d995c2fa593fb517a99e4b8b5f775afbeaf (patch) | |
| tree | c6080ebbf909fb45fb055930abe64bbfb62a41f0 /src/test/java | |
| parent | 7367968483e4ddfedfa47598c508b343b44fc852 (diff) | |
Adding getLookupTable API.
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java | 31 | 
1 files changed, 28 insertions, 3 deletions
| diff --git a/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java b/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java index 69f50c2..b7d32e1 100644 --- a/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java +++ b/src/test/java/com/p4square/ccbapi/CCBAPIClientTest.java @@ -9,12 +9,9 @@ import java.io.IOException;  import java.io.InputStream;  import java.net.URI;  import java.time.LocalDate; -import java.util.Collections; -import java.util.Map;  import org.easymock.EasyMock;  import org.junit.Test; -import org.junit.rules.ExpectedException;  import static org.junit.Assert.*; @@ -111,6 +108,34 @@ public class CCBAPIClientTest {      }      @Test +    public void testGetLookupTableListSuccess() throws Exception { +        // Set expectation. +        URI expectedURI = new URI("https://localhost:8080/api.php?srv=significant_event_list"); +        InputStream is = getClass().getResourceAsStream("model/ccb_lookup_table_list_response.xml"); +        EasyMock.expect(mockHttpClient.sendPostRequest(expectedURI, null)) +                .andReturn(is); +        EasyMock.replay(mockHttpClient); + +        // Test significant_event_list. +        GetLookupTableResponse response = client.getLookupTable( +                new GetLookupTableRequest().withType(LookupTableType.SIGNIFICANT_EVENT)); + +        // Verify results. +        EasyMock.verify(mockHttpClient); +        assertNull(response.getErrors()); +        assertEquals(5, response.getItems().size()); +        assertEquals(1, response.getItems().get(0).getId()); +        assertEquals(1, response.getItems().get(0).getOrder()); +        assertEquals("High School Graduation", response.getItems().get(0).getName()); +    } + +    @Test(expected = IllegalArgumentException.class) +    public void testGetLookupTableListWithNullType() throws Exception { +        // This should throw an IllegalArgumentException. +        client.getLookupTable(new GetLookupTableRequest()); +    } + +    @Test      public void testGetIndividualProfilesById() throws Exception {          // Set expectation.          URI expectedURI = new URI("https://localhost:8080/api.php?srv=individual_profile_from_id&individual_id=48"); | 
