@Test
@SuppressWarnings("unchecked")
public void testFindSecurityProfile() throws Exception {

    final CloseableHttpResponse response = mock(CloseableHttpResponse.class);
    when(response.getStatusLine()).thenReturn(HTTP_200_REPSONSE);
    when(response.getEntity()).thenReturn(new StringEntity(SEC_PROFILE_LIST_JSON_RESPONSE));
    final CloseableHttpClient httpClient = spy(HttpClientHelper.createHttpClient(2));
    doReturn(response).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), any(HttpClientContext.class));
    final NiciraNvpApi api = buildApi(httpClient);
    final List<SecurityProfile> actualProfiles = api.findSecurityProfile();
    assertThat("Wrong number of results", actualProfiles, hasSize(2));
    assertThat("Wrong Uuid in the newly created SecurityProfile", actualProfiles, Matchers.<SecurityProfile> contains(
                    hasProperty("uuid", equalTo(UUID)),
                    hasProperty("uuid", equalTo(UUID2))));
    assertThat("Wrong HREF in the newly created SecurityProfile", actualProfiles, Matchers.<SecurityProfile> contains(
                    hasProperty("href", equalTo(HREF)),
                    hasProperty("href", equalTo(HREF2))));
    assertThat("Wrong Schema in the newly created SecurityProfile", actualProfiles, Matchers.<SecurityProfile> contains(
                    hasProperty("schema", equalTo(SCHEMA)),
                    hasProperty("schema", equalTo(SCHEMA2))));
    verify(response, times(1)).close();
    verify(httpClient).execute(any(HttpHost.class), HttpUriRequestMethodMatcher.aMethod("GET"), any(HttpClientContext.class));
    verify(httpClient).execute(any(HttpHost.class), HttpUriRequestQueryMatcher.aQuery("fields=*"), any(HttpClientContext.class));
    verify(httpClient).execute(any(HttpHost.class), HttpUriRequestPathMatcher.aPath(NiciraConstants.SEC_PROFILE_URI_PREFIX), any(HttpClientContext.class));
}