@@ -0,0 +1,3655 @@
+package com.telefonica.euro_iaas.sdc.util;%0A%0Aimport static org.mockito.Matchers.anyObject;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0Aimport java.net.URL;%0Aimport java.security.KeyManagementException;%0Aimport java.security.NoSuchAlgorithmException;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport javax.net.ssl.HttpsURLConnection;%0Aimport javax.ws.rs.HttpMethod;%0A%0Aimport org.apache.commons.io.IOUtils;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mockito;%0A%0Apublic class HttpsClientTest %7B%0A%0A    private HttpsClient httpsClient;%0A    private HttpsURLConnection httpsURLConnection;%0A    private Map%3CString, String%3E headers = new HashMap%3CString, String%3E();%0A    private ConnectionSetup connectionSetup;%0A%0A    @Before%0A    public void setup() throws KeyManagementException, NoSuchAlgorithmException, IOException %7B%0A        httpsURLConnection = mock(HttpsURLConnection.class);%0A        connectionSetup = mock(ConnectionSetup.class);%0A        headers.put(HttpsClient.HEADER_AUTH, %22%22);%0A        headers.put(HttpsClient.HEADER_TENNANT, %22%22);%0A        %0A        when(connectionSetup.createConnection((URL)anyObject())).thenReturn(httpsURLConnection);%0A        %0A        String source = %22test%22;%0A        InputStream in = IOUtils.toInputStream(source, %22UTF-8%22);%0A        when(httpsURLConnection.getInputStream()).thenReturn(in);%0A        %0A        OutputStream os = new OutputStream() %7B%0A            @Override%0A            public void write(int b) throws IOException %7B%0A            %7D%0A        %7D;%0A        when(httpsURLConnection.getOutputStream()).thenReturn(os);%0A        %0A        %0A        httpsClient = new HttpsClient();%0A        httpsClient.setConnectionSetup(connectionSetup);%0A%0A    %7D%0A%0A    @Test%0A    public void testOk() throws IOException, KeyManagementException, NoSuchAlgorithmException%7B%0A        %0A        when(httpsURLConnection.getResponseCode()).thenReturn(200);%0A        %0A        httpsClient.doHttps(HttpMethod.POST,%22https://www.pepe.com%22, Mockito.anyString(), headers);%0A        %0A        verify(httpsURLConnection,times(1)).getResponseCode();%0A        %0A    %7D%0A    %0A    @Test%0A    public void test500() throws IOException, KeyManagementException, NoSuchAlgorithmException%7B%0A        %0A        when(httpsURLConnection.getResponseCode()).thenReturn(500);%0A        %0A        int rc=httpsClient.doHttps(HttpMethod.POST,%22https://www.pepe.com%22, Mockito.anyString(), headers);%0A        %0A        verify(httpsURLConnection,times(1)).getResponseCode();%0A        %0A        assertEquals(500, rc);%0A        %0A    %7D%0A    %0A    @Test%0A    public void testOk_GET() throws IOException, KeyManagementException, NoSuchAlgorithmException%7B%0A        %0A        when(httpsURLConnection.getResponseCode()).thenReturn(200);%0A        %0A        httpsClient.doHttps(HttpMethod.GET,%22https://www.pepe.com%22, Mockito.anyString(), headers);%0A        %0A        verify(httpsURLConnection,times(1)).getResponseCode();%0A        verify(httpsURLConnection,times(1)).setRequestMethod(%22GET%22);%0A        %0A    %7D%0A    %0A    @Test%0A    public void testOk_DELETE() throws IOException, KeyManagementException, NoSuchAlgorithmException%7B%0A        %0A        when(httpsURLConnection.getResponseCode()).thenReturn(200);%0A        %0A        httpsClient.doHttps(HttpMethod.DELETE,%22https://www.pepe.com%22, Mockito.anyString(), headers);%0A        %0A        verify(httpsURLConnection,times(1)).getResponseCode();%0A        verify(httpsURLConnection,times(1)).setRequestMethod(%22DELETE%22);%0A        %0A    %7D%0A%7D%0A

fix tests