sdk/java/src/test/java/com/example/www/controllers/CheckIPAddressesControllerTest.java
/**
     * Check if an IP Address is Already White- or Black-Listed
     * @throws Throwable
     */
Check if an IP Address is Already White- or Black-Listed
@throws Throwable
Check if an IP Address is Already White - or Black - Listed @throws Throwable
@Test
    public void testTestForListMembership1() throws Throwable {
        String ipAddress = "192.168.100.14";
        TestForListMembershipResponse result = null;
        controller.setHttpCallBack(httpResponse);
        try {
            result = controller.testForListMembership(ipAddress);
        } 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\": {    \"List\": \"Whitelist\",    \"Status\": \"Success\",    \"Message\": \"\"  },  \"Entry\": {    \"IPv4\": \"192.168.100.14/24\",    \"IPv6\": \"2001:db8::/64\",    \"Start_Date\": \"2019-04-05T02:04:16Z\",    \"End_Date\": \"2019-04-05T02:04:16Z\",    \"Comments\": \"noteworthy note\",    \"Active\": true  }}", 
                TestHelper.convertStreamToString(httpResponse.getResponse().getRawBody()));
    }
@ Test public void testTestForListMembership1 ( ) throws Throwable { String ipAddress = "192.168.100.14" ; TestForListMembershipResponse result = null ; controller . setHttpCallBack ( httpResponse ) ; try { result = controller . testForListMembership ( ipAddress ) ; } 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\": {    \"List\": \"Whitelist\",    \"Status\": \"Success\",    \"Message\": \"\"  },  \"Entry\": {    \"IPv4\": \"192.168.100.14/24\",    \"IPv6\": \"2001:db8::/64\",    \"Start_Date\": \"2019-04-05T02:04:16Z\",    \"End_Date\": \"2019-04-05T02:04:16Z\",    \"Comments\": \"noteworthy note\",    \"Active\": true  }}" , TestHelper . convertStreamToString ( httpResponse . getResponse ( ) . getRawBody ( ) ) ) ; }
Check if an IP Address is Already White- or Black-Listed
 @throws Throwable
Check if an IP Address is Already White - or Black - Listed @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