sdk/java/src/test/java/com/example/www/controllers/WhitelistIPAddressesControllerTest.java
/**
     * Search for IP Addresses in the Whitelist
     * @throws Throwable
     */
Search for IP Addresses in the Whitelist
@throws Throwable
Search for IP Addresses in the Whitelist @throws Throwable
@Test
    public void testSearch1() throws Throwable {
        String searchFilter = "192.168.100.0+24,192.168.101.0+24";
        SearchResponse result = null;
        controller.setHttpCallBack(httpResponse);
        try {
            result = controller.search(searchFilter);
        } catch(APIException e) {};
        assertNotNull("Response is null", 
                httpResponse.getResponse());
        assertEquals("Status is not 200", 
                200, httpResponse.getResponse().getStatusCode());
        Map<String, String> headers = new LinkedHashMap<String, String>();
        headers.put("Content-Type", TestHelper.nullString);
        assertTrue("Headers do not match", TestHelper.areHeadersProperSubsetOf(
                headers, httpResponse.getResponse().getHeaders(), true));
        assertNotNull("Result does not exist", 
                result);
        assertEquals("Response body does not match exactly",
                "{  \"Result\": {    \"Status\": \"Success\",    \"Message\": \"\"  },  \"SearchResult\": {    \"Input_IP\": \"192.168.100.0/24,192.168.101.0/24\",    \"Entries\": [      {        \"EntryID\": \"884d9804999fc47a3c2694e49ad2536a\",        \"IPv4\": \"192.168.100.14/24\"      }    ]  }}", 
                TestHelper.convertStreamToString(httpResponse.getResponse().getRawBody()));
    }
@ Test public void testSearch1 ( ) throws Throwable { String searchFilter = "192.168.100.0+24,192.168.101.0+24" ; SearchResponse result = null ; controller . setHttpCallBack ( httpResponse ) ; try { result = controller . search ( searchFilter ) ; } catch ( APIException e ) { } ; assertNotNull ( "Response is null" , httpResponse . getResponse ( ) ) ; assertEquals ( "Status is not 200" , 200 , httpResponse . getResponse ( ) . getStatusCode ( ) ) ; Map < String , String > headers = new LinkedHashMap < String , String > ( ) ; headers . put ( "Content-Type" , TestHelper . nullString ) ; assertTrue ( "Headers do not match" , TestHelper . areHeadersProperSubsetOf ( headers , httpResponse . getResponse ( ) . getHeaders ( ) , true ) ) ; assertNotNull ( "Result does not exist" , result ) ; assertEquals ( "Response body does not match exactly" , "{  \"Result\": {    \"Status\": \"Success\",    \"Message\": \"\"  },  \"SearchResult\": {    \"Input_IP\": \"192.168.100.0/24,192.168.101.0/24\",    \"Entries\": [      {        \"EntryID\": \"884d9804999fc47a3c2694e49ad2536a\",        \"IPv4\": \"192.168.100.14/24\"      }    ]  }}" , TestHelper . convertStreamToString ( httpResponse . getResponse ( ) . getRawBody ( ) ) ) ; }
Search for IP Addresses in the Whitelist
 @throws Throwable
Search for IP Addresses in the Whitelist @throws Throwable
// Parameters for the API call // Set callback and perform API call // Test whether the response is null // Test response code // Test headers // Test whether the captured response is as we expected