diff options
Diffstat (limited to 'src/test/java/com/p4square/ccbapi')
-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"); |