@Test
public void testUpdateSecurityProfile() throws Exception {

    final CloseableHttpResponse response = mock(CloseableHttpResponse.class);
    when(response.getStatusLine()).thenReturn(HTTP_201_REPSONSE);
    when(response.getEntity()).thenReturn(new StringEntity(SEC_PROFILE_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);
    api.updateSecurityProfile(new SecurityProfile(), UUID);
    verify(response, times(1)).close();
    verify(httpClient).execute(any(HttpHost.class), HttpUriRequestMethodMatcher.aMethod("PUT"), any(HttpClientContext.class));
    verify(httpClient).execute(any(HttpHost.class), HttpUriRequestPathMatcher.aPath(NiciraConstants.SEC_PROFILE_URI_PREFIX + "/" + UUID), any(HttpClientContext.class));
}